[1/4] mk: use script to generate examples.dox
Checks
Commit Message
This will make it possible to generate the file in the same way from
Meson as well.
Signed-off-by: Luca Boccassi <bluca@debian.org>
---
doc/api/generate_examples.sh | 14 ++++++++++++++
mk/rte.sdkdoc.mk | 5 +----
2 files changed, 15 insertions(+), 4 deletions(-)
create mode 100755 doc/api/generate_examples.sh
Comments
31/08/2018 20:20, Luca Boccassi:
> +# SC2129 - avoid multiple individual redirects
What is SC2129 ?
> +{ \
> + printf '/**\n'; \
> + printf '@page examples DPDK Example Programs\n\n'; \
> + find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example examples/%P\n' | LC_ALL=C sort; \
> + printf '*/\n'; \
> +} > "${API_EXAMPLES}"
Why using backslashes (continuation lines)?
On Mon, 2018-09-03 at 02:54 +0200, Thomas Monjalon wrote:
> 31/08/2018 20:20, Luca Boccassi:
> > +# SC2129 - avoid multiple individual redirects
>
> What is SC2129 ?
shellcheck - will clarify in v2
> > +{ \
> > + printf '/**\n'; \
> > + printf '@page examples DPDK Example Programs\n\n'; \
> > + find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example
> > examples/%P\n' | LC_ALL=C sort; \
> > + printf '*/\n'; \
> > +} > "${API_EXAMPLES}"
>
> Why using backslashes (continuation lines)?
Good point, will remove in v2
On Mon, Sep 03, 2018 at 10:07:07AM +0100, Luca Boccassi wrote:
> On Mon, 2018-09-03 at 02:54 +0200, Thomas Monjalon wrote:
> > 31/08/2018 20:20, Luca Boccassi:
> > > +# SC2129 - avoid multiple individual redirects
> >
> > What is SC2129 ?
>
> shellcheck - will clarify in v2
>
> > > +{ \
> > > + printf '/**\n'; \
> > > + printf '@page examples DPDK Example Programs\n\n'; \
> > > + find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example
> > > examples/%P\n' | LC_ALL=C sort; \
> > > + printf '*/\n'; \
> > > +} > "${API_EXAMPLES}"
> >
> > Why using backslashes (continuation lines)?
>
> Good point, will remove in v2
>
Agree, rather than using continuation lines, I suggest one of the
following:
* use exec > ${API_EXAMPLES} at the top of the script
* let the script just print to stdout and have make/meson put that in the
output file for you.
/Bruce
On Fri, 2018-09-07 at 17:13 +0100, Bruce Richardson wrote:
> On Mon, Sep 03, 2018 at 10:07:07AM +0100, Luca Boccassi wrote:
> > On Mon, 2018-09-03 at 02:54 +0200, Thomas Monjalon wrote:
> > > 31/08/2018 20:20, Luca Boccassi:
> > > > +# SC2129 - avoid multiple individual redirects
> > >
> > > What is SC2129 ?
> >
> > shellcheck - will clarify in v2
> >
> > > > +{ \
> > > > + printf '/**\n'; \
> > > > + printf '@page examples DPDK Example Programs\n\n'; \
> > > > + find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@examp
> > > > le
> > > > examples/%P\n' | LC_ALL=C sort; \
> > > > + printf '*/\n'; \
> > > > +} > "${API_EXAMPLES}"
> > >
> > > Why using backslashes (continuation lines)?
> >
> > Good point, will remove in v2
> >
>
> Agree, rather than using continuation lines, I suggest one of the
> following:
> * use exec > ${API_EXAMPLES} at the top of the script
> * let the script just print to stdout and have make/meson put that in
> the
> output file for you.
>
> /Bruce
exec > works and checkbashism is also happy with it, so used that in v2
new file mode 100755
@@ -0,0 +1,14 @@
+#! /bin/sh -e
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright 2018 Luca Boccassi <bluca@debian.org>
+
+EXAMPLES_DIR=$1
+API_EXAMPLES=$2
+
+# SC2129 - avoid multiple individual redirects
+{ \
+ printf '/**\n'; \
+ printf '@page examples DPDK Example Programs\n\n'; \
+ find "${EXAMPLES_DIR}" -type f -name '*.c' -printf '@example examples/%P\n' | LC_ALL=C sort; \
+ printf '*/\n'; \
+} > "${API_EXAMPLES}"
@@ -63,10 +63,7 @@ api-html-clean:
$(API_EXAMPLES): api-html-clean
$(Q)mkdir -p $(@D)
- @printf '/**\n' > $(API_EXAMPLES)
- @printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES)
- @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES)
- @printf '*/\n' >> $(API_EXAMPLES)
+ $(Q)doc/api/generate_examples.sh examples $(API_EXAMPLES)
guides-pdf-clean: guides-pdf-img-clean
guides-pdf-img-clean: