[PATCH 1/2] Simplify generate_dist_headers.sh in Milena.

* generate_dist_headers.sh: Use a heredoc instead of multiple echoes. Do not add mln/version.hh (leave it to Makefile.am). Echo status messages on stderr, not stdout. Use a single `find' to search `*.hh' and `*.hxx' files. Remove the useless post-processing pass dropping Subversion's cached copies, as they are not caught by find anyway. Sort results before performing string replacement. * Makefile.am (nobase_include_HEADERS): Add mln/version.hh. --- milena/ChangeLog | 14 ++++++++++++++ milena/Makefile.am | 3 +++ milena/generate_dist_headers.sh | 24 +++++++++++++++--------- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index a059a09..462287a 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,19 @@ 2009-06-12 Roland Levillain <roland@lrde.epita.fr> + Simplify generate_dist_headers.sh in Milena. + + * generate_dist_headers.sh: Use a heredoc instead of multiple + echoes. + Do not add mln/version.hh (leave it to Makefile.am). + Echo status messages on stderr, not stdout. + Use a single `find' to search `*.hh' and `*.hxx' files. + Remove the useless post-processing pass dropping Subversion's + cached copies, as they are not caught by find anyway. + Sort results before performing string replacement. + * Makefile.am (nobase_include_HEADERS): Add mln/version.hh. + +2009-06-12 Roland Levillain <roland@lrde.epita.fr> + Regen Makefile helpers. * doc/outputs/outputs.mk, diff --git a/milena/Makefile.am b/milena/Makefile.am index a1db868..3c7269d 100644 --- a/milena/Makefile.am +++ b/milena/Makefile.am @@ -82,6 +82,9 @@ $(srcdir)/headers.mk: $(srcdir)/generate_dist_headers.sh include $(srcdir)/headers.mk +# Generated by configure from mln/version.hh.in. +nobase_include_HEADERS += mln/version.hh + EXTRA_DIST += \ img/README \ img/fly.pbm \ diff --git a/milena/generate_dist_headers.sh b/milena/generate_dist_headers.sh index 6f72a5f..bf276d7 100755 --- a/milena/generate_dist_headers.sh +++ b/milena/generate_dist_headers.sh @@ -1,20 +1,26 @@ #! /bin/sh -# Generate milena/headers.mk -# ------------------------------ +# Generate headers.mk. +# -------------------- # List all the headers in order to make them part of distribution. # Use the C locale to have a deterministic sort. export LC_ALL=C -echo "## Generated by ./generate_dist_headers, do not modify ##" > headers.mk -echo "" >> headers.mk -echo "nobase_include_HEADERS = \\" >> headers.mk -echo "mln/version.hh \\" >> headers.mk -echo "generating headers.mk" +me=`basename $0` +output=headers.mk -find mln -type f -name '*.hh'| grep -v "\.svn" | sed -e 's/$/ \\/g' | sort >> headers.mk -find mln -type f -name '*.hxx'| grep -v "\.svn" | sed -e 's/$/ \\/g'| sort >> headers.mk +echo "Generating $output..." >&2 +rm -f "$output" +cat <<EOF >"$output" +## Generated by \`$me', do not edit by hand. + +nobase_include_HEADERS = \\ +EOF + +find mln -type f -a \( -name '*.hh' -o -name '*.hxx' \) \ + | sort \ + | sed -e 's/$/ \\/g' >> headers.mk last_line=`tail -n 1 headers.mk | sed -e 's/\\\//g'` # remove '\' in last line sed '$d' < headers.mk > headers.mk.tmp # remove last line -- 1.6.2.4
participants (1)
-
Roland Levillain