maint.mk: avoid side-effect in latest syntax-check
authorJim Meyering <meyering@redhat.com>
Tue, 27 Apr 2010 14:32:40 +0000 (16:32 +0200)
committerJim Meyering <meyering@redhat.com>
Tue, 27 Apr 2010 14:41:08 +0000 (16:41 +0200)
* top/maint.mk (sc_prohibit_always_true_header_tests): Rework not
to run commands via $(shell...), and hence to incur cost only when
the new rule is actually run.

ChangeLog
top/maint.mk

index 64a9a3eadc5e1f7d5be599e9b78faa524937a70f..4d6e4736894cf5602fb2b3e2c39b07764f5952ba 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-04-27  Jim Meyering  <meyering@redhat.com>
 
+       maint.mk: avoid side-effect in latest syntax-check
+       * top/maint.mk (sc_prohibit_always_true_header_tests): Rework not
+       to run commands via $(shell...), and hence to incur cost only when
+       the new rule is actually run.
+
        maint.mk: syntax-check: prohibit HAVE_<header>_H that are always true
        Derive the list of guaranteed header names from gnulib/lib/*.in.h,
        and use that to create a regexp used to detect all #if HAVE_..._H uses.
index 159fe8310e7443ddcaff6765963c7ef9e4cb2143..8d9a52233028e20b3be5934f7712e15e240850ee 100644 (file)
@@ -649,20 +649,21 @@ sc_useless_cpp_parens:
 # using the appropriate gnulib module.  CAUTION: for each "unnecessary"
 # #if HAVE_HEADER_H that you remove, be sure that your project explicitly
 # requires the gnulib module that guarantees the usability of that header.
-gl_assured_headers_ := \
-  $(shell cd $(gnulib_dir)/lib && ls -1 *.in.h|sed 's/\.in\.h$$/ \\/')
+gl_assured_headers_ = \
+  cd $(gnulib_dir)/lib && echo *.in.h|sed 's/\.in\.h//'
 
 # Convert the list of names to upper case, and replace each space with "|".
 az_ = abcdefghijklmnopqrstuvwxyz
 AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ
-gl_header_upper_case_or_ := \
-  $(shell echo $(gl_assured_headers_)                                  \
+gl_header_upper_case_or_ =                                             \
+  $$($(gl_assured_headers_)                                            \
     | tr $(az_)/.- $(AZ_)___                                           \
     | tr -s ' ' '|'                                                    \
-   )
-gl_have_header_regex_ = HAVE_($(gl_header_upper_case_or_))_H
+    )
 sc_prohibit_always_true_header_tests:
-       @prohibit='\<$(gl_have_header_regex_)\>'                        \
+       @or=$(gl_header_upper_case_or_);                                \
+       re="HAVE_($$or)_H";                                             \
+       prohibit='\<'"$$re"'\>'                                         \
        halt='do not test the above HAVE_<header>_H symbol(s);\n'\
 '  with the corresponding gnulib module, they are always true'         \
          $(_sc_search_regexp)