sc_tabs_in_texi \
sc_at_in_texi
- ## These check avoids accidental configure substitutions in the source.
- ## There are exactly 8 lines that should be modified from automake.in to
- ## automake, and 9 lines that should be modified from aclocal.in to
- ## aclocal.
-$(syntax_check_rules): automake aclocal
++$(syntax_check_rules): bin/automake bin/aclocal
+ maintainer-check: $(syntax_check_rules)
+ .PHONY: 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
+
+ # The recipes of syntax checks require a modern GNU grep.
+ sc_sanity_gnu_grep:
+ $(AM_V_GEN)grep --version | grep 'GNU grep' >/dev/null 2>&1 \
+ && ab=$$(printf 'a\nb') \
+ && test "$$(printf 'xa\nb\nc' | grep -Pzo 'a\nb')" = "$$ab" \
+ || { \
+ echo "Syntax checks recipes require a modern GNU grep" >&2; \
+ exit 1; \
+ }
+ .PHONY: sc_sanity_gnu_grep
+ $(syntax_check_rules): sc_sanity_gnu_grep
+
+ # These check avoids accidental configure substitutions in the source.
+ # There are exactly 8 lines that should be modified from automake.in to
+ # automake, and 9 lines that should be modified from aclocal.in to
+ # aclocal.
automake_diff_no = 8
aclocal_diff_no = 9
+sc_diff_automake sc_diff_aclocal: in=$($*_in)
+sc_diff_automake sc_diff_aclocal: out=$($*_script)
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' $(in) > $$in \
+ && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $(out) > $$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 "Found unexpected diffs between $(in) and $(out)"; \
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.
+ # Expect no instances of '${...}'. However, $${...} is ok, since that
+ # is a shell construct, not a Makefile construct.
sc_no_brace_variable_expansions:
@if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
echo "Found too many uses of '\$${' in the lines above." 1>&2; \
exit 1; \
else :; fi
- ## Make sure 'rm' is called with '-f'.
+ # 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; \
exit 1; \
else :; fi
- ## We never want to use "undef", only "delete", but for $/.
+ # We never want to use "undef", only "delete", but for $/.
sc_perl_no_undef:
- @if grep -n -w 'undef ' $(srcdir)/automake.in | \
+ @if grep -n -w 'undef ' $(automake_in) | \
grep -F -v 'undef $$/'; then \
- echo "Found undef in automake.in; use delete instead" 1>&2; \
+ echo "Found 'undef' in the lines above; use 'delete' instead" 1>&2; \
exit 1; \
fi
- ## We never want split (/ /,...), only split (' ', ...).
+ # We never want split (/ /,...), only split (' ', ...).
sc_perl_no_split_regex_space:
- @if grep -n 'split (/ /' $(srcdir)/automake.in; then \
+ @if grep -n 'split (/ /' $(automake_in) $(acloca_in); then \
echo "Found bad split in the lines above." 1>&2; \
exit 1; \
fi
- ## Look for cd within backquotes
+ # Look for cd within backquotes
sc_cd_in_backquotes:
- @if grep -n '^[^#]*` *cd ' $(srcdir)/automake.in $(ams); then \
+ @if grep -n '^[^#]*` *cd ' $(automake_in) $(ams); then \
echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
exit 1; \
fi
- ## Look for cd to a relative directory (may be influenced by CDPATH).
- ## Skip some known directories that are OK.
+ # Look for cd to a relative directory (may be influenced by CDPATH).
+ # Skip some known directories that are OK.
sc_cd_relative_dir:
- @if grep -n '^[^#]*cd ' $(srcdir)/automake.in $(ams) | \
+ @if grep -n '^[^#]*cd ' $(automake_in) $(ams) | \
grep -v 'echo.*cd ' | \
grep -v 'am__cd =' | \
grep -v '^[^#]*cd [./]' | \
exit 1; \
fi
- ## Using @_ in a scalar context is most probably a programming error.
+ # Using @_ in a scalar context is most probably a programming error.
sc_perl_at_uscore_in_scalar_context:
- @if grep -Hn '[^@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' $(srcdir)/automake.in; then \
+ @if grep -Hn '[^%@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' \
+ $(automake_in) $(aclocal_in); then \
echo "Using @_ in a scalar context in the lines above." 1>&2; \
exit 1; \
fi
exit 1; \
fi
- ## Don't let AMDEP_TRUE substitution appear in automake.in.
+ # Don't let AMDEP_TRUE substitution appear in automake.in.
sc_AMDEP_TRUE_in_automake_in:
- @if grep '@AMDEP''_TRUE@' $(srcdir)/automake.in; then \
+ @if grep '@AMDEP''_TRUE@' $(automake_in); then \
echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
exit 1; \
fi
- ## Recursive make invocations should always pass $(AM_MAKEFLAGS)
- ## to $(MAKE), for portability to non-GNU make.
+ # Recursive make invocations should always pass $(AM_MAKEFLAGS)
+ # to $(MAKE), for portability to non-GNU make.
-sc_make_without_am_makeflags:
- @if grep '^[^#].*(MAKE) ' $(ams) $(srcdir)/automake.in \
+sc_tests_make_without_am_makeflags:
+ @if grep '^[^#].*(MAKE) ' $(ams) $(automake_in) \
| grep -Fv '$$(AM_MAKEFLAGS)'; \
then \
echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
exit 1; \
fi
- ## Try to make sure all @...@ substitutions are covered by our
- ## substitution rule.
+ # Try to make sure all @...@ substitutions are covered by our
+ # substitution rule.
sc_perl_at_substs:
- @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' aclocal | wc -l` -ne 0; then \
+ @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' bin/aclocal | wc -l` -ne 0; then \
echo "Unresolved @...@ substitution in aclocal" 1>&2; \
exit 1; \
fi