Merge branch 'branch-1.13.2' into maint
[platform/upstream/automake.git] / maintainer / syntax-checks.mk
index 375738b..ab316cb 100644 (file)
@@ -86,19 +86,22 @@ sc_at_in_texi
 automake_diff_no = 8
 aclocal_diff_no = 9
 sc_diff_automake sc_diff_aclocal: sc_diff_% :
-       @set +e; tmp=$*-diffs.tmp; \
-        diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
-        added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
-        removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
-        test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+       @set +e; \
+       in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
+         && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \
+         && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \
+         && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
+         && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
+         && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
+         && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
          || { \
            echo "Found unexpected diffs between $*.in and $*"; \
            echo "Lines added:   $$added"  ; \
            echo "Lines removed: $$removed"; \
-           cat $$tmp >&2; \
+           cat $$diffs; \
            exit 1; \
-         } >&1; \
-       rm -f $$tmp
+         } >&2; \
+       rm -f $$in $$out $$diffs
 
 ## Expect no instances of '${...}'.  However, $${...} is ok, since that
 ## is a shell construct, not a Makefile construct.
@@ -111,7 +114,7 @@ sc_no_brace_variable_expansions:
 ## Make sure 'rm' is called with '-f'.
 sc_rm_minus_f:
        @if grep -v '^#' $(ams) $(xtests) \
-          | grep -vE '/(spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
+          | grep -vE '/(rm-f-probe\.sh|spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
           | grep -E '\<rm ([^-]|\-[^f ]*\>)'; \
        then \
          echo "Suspicious 'rm' invocation." 1>&2; \
@@ -372,13 +375,7 @@ sc_tests_overriding_macros_on_cmdline:
 # The first s/// tries to account for usages like "$MAKE || st=$?".
 # 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
 # their definitions, hence the more complex last three substitutions below.
-# Also, the 'make-dryrun.sh' is whitelisted, since there we need to
-# override variables from the command line in order to cover the expected
-# code paths.
-       @tests=`for t in $(xtests); do \
-                 case $$t in */make-dryrun.sh);; *) echo $$t;; esac; \
-               done`; \
-       if sed -e 's/ || .*//' -e 's/ && .*//' \
+       @if sed -e 's/ || .*//' -e 's/ && .*//' \
                -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
                -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
                -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
@@ -387,7 +384,7 @@ sc_tests_overriding_macros_on_cmdline:
                -e "s/ exp='[^']*'/ /" \
                -e 's/ exp="[^"]*"/ /' \
                -e 's/ exp=[^ ]/ /' \
-             $$tests | grep '\$$MAKE .*='; then \
+             $(xtests) | grep '\$$MAKE .*='; then \
          echo 'Rewrite "$$MAKE foo=bar" as "foo=bar $$MAKE -e" in the above lines,' 1>&2; \
          echo 'it is more portable.' 1>&2; \
          exit 1; \
@@ -542,3 +539,7 @@ maintainer-check: $(syntax_check_rules)
 ## Check that the list of tests given in the Makefile is equal to the
 ## list of all test scripts in the Automake testsuite.
 maintainer-check: maintainer-check-list-of-tests
+
+# I'm a lazy typist.
+lint: maintainer-check
+.PHONY: lint