syntax-checks.mk 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541
  1. # Maintainer checks for Automake. Requires GNU make.
  2. # Copyright (C) 2012-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # We also have to take into account VPATH builds (where some generated
  17. # tests might be in '$(builddir)' rather than in '$(srcdir)'), TAP-based
  18. # tests script (which have a '.tap' extension) and helper scripts used
  19. # by other test cases (which have a '.sh' extension).
  20. xtests := $(shell \
  21. if test $(srcdir) = .; then \
  22. dirs=.; \
  23. else \
  24. dirs='$(srcdir) .'; \
  25. fi; \
  26. for d in $$dirs; do \
  27. for s in tap sh; do \
  28. ls $$d/t/ax/*.$$s $$d/t/*.$$s $$d/contrib/t/*.$$s 2>/dev/null; \
  29. done; \
  30. done | sort)
  31. xdefs = \
  32. $(srcdir)/t/ax/am-test-lib.sh \
  33. $(srcdir)/t/ax/test-lib.sh \
  34. $(srcdir)/t/ax/test-defs.in
  35. ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
  36. # Some simple checks, and then ordinary check. These are only really
  37. # guaranteed to work on my machine.
  38. syntax_check_rules = \
  39. $(sc_tests_plain_check_rules) \
  40. sc_diff_automake \
  41. sc_diff_aclocal \
  42. sc_no_brace_variable_expansions \
  43. sc_rm_minus_f \
  44. sc_no_for_variable_in_macro \
  45. sc_mkinstalldirs \
  46. sc_pre_normal_post_install_uninstall \
  47. sc_perl_no_undef \
  48. sc_perl_no_split_regex_space \
  49. sc_cd_in_backquotes \
  50. sc_cd_relative_dir \
  51. sc_perl_at_uscore_in_scalar_context \
  52. sc_perl_local \
  53. sc_AMDEP_TRUE_in_automake_in \
  54. sc_make_without_am_makeflags \
  55. sc_tests_no_source_defs \
  56. sc_tests_obsolete_variables \
  57. sc_tests_here_document_format \
  58. sc_tests_command_subst \
  59. sc_tests_no_run_make_redirect \
  60. sc_tests_exit_not_Exit \
  61. sc_tests_automake_fails \
  62. sc_tests_overriding_macros_on_cmdline \
  63. sc_tests_no_make_e \
  64. sc_tests_plain_sleep \
  65. sc_tests_ls_t \
  66. sc_m4_am_plain_egrep_fgrep \
  67. sc_tests_no_configure_in \
  68. sc_tests_PATH_SEPARATOR \
  69. sc_tests_logs_duplicate_prefixes \
  70. sc_tests_makefile_variable_order \
  71. sc_perl_at_substs \
  72. sc_unquoted_DESTDIR \
  73. sc_tabs_in_texi \
  74. sc_at_in_texi
  75. $(syntax_check_rules): bin/automake bin/aclocal
  76. maintainer-check: $(syntax_check_rules)
  77. .PHONY: maintainer-check $(syntax_check_rules)
  78. # Check that the list of tests given in the Makefile is equal to the
  79. # list of all test scripts in the Automake testsuite.
  80. maintainer-check: maintainer-check-list-of-tests
  81. # I'm a lazy typist.
  82. lint: maintainer-check
  83. .PHONY: lint
  84. # The recipes of syntax checks require a modern GNU grep.
  85. sc_sanity_gnu_grep:
  86. $(AM_V_GEN)grep --version | grep 'GNU grep' >/dev/null 2>&1 \
  87. && ab=$$(printf 'a\nb') \
  88. && test "$$(printf 'xa\nb\nc' | grep -Pzo 'a\nb')" = "$$ab" \
  89. || { \
  90. echo "Syntax checks recipes require a modern GNU grep" >&2; \
  91. exit 1; \
  92. }
  93. .PHONY: sc_sanity_gnu_grep
  94. $(syntax_check_rules): sc_sanity_gnu_grep
  95. # These check avoids accidental configure substitutions in the source.
  96. # There are exactly 8 lines that should be modified from automake.in to
  97. # automake, and 9 lines that should be modified from aclocal.in to
  98. # aclocal.
  99. automake_diff_no = 8
  100. aclocal_diff_no = 9
  101. sc_diff_automake sc_diff_aclocal: in=$($*_in)
  102. sc_diff_automake sc_diff_aclocal: out=$($*_script)
  103. sc_diff_automake sc_diff_aclocal: sc_diff_% :
  104. @set +e; \
  105. in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
  106. && sed '/^#!.*[pP]rototypes/d' $(in) > $$in \
  107. && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $(out) > $$out \
  108. && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
  109. && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
  110. && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
  111. && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
  112. || { \
  113. echo "Found unexpected diffs between $(in) and $(out)"; \
  114. echo "Lines added: $$added" ; \
  115. echo "Lines removed: $$removed"; \
  116. cat $$diffs; \
  117. exit 1; \
  118. } >&2; \
  119. rm -f $$in $$out $$diffs
  120. # Expect no instances of '${...}'. However, $${...} is ok, since that
  121. # is a shell construct, not a Makefile construct.
  122. sc_no_brace_variable_expansions:
  123. @if grep -v '^ *#' $(ams) | grep -F '$${' | grep -F -v '$$$$'; then \
  124. echo "Found too many uses of '\$${' in the lines above." 1>&2; \
  125. exit 1; \
  126. else :; fi
  127. # Make sure 'rm' is called with '-f'.
  128. sc_rm_minus_f:
  129. @if grep -v '^#' $(ams) $(xtests) \
  130. | grep -vE '/(rm-f-probe\.sh|spy-rm\.tap|subobj-clean.*-pr10697\.sh):' \
  131. | grep -E '\<rm ([^-]|\-[^f ]*\>)'; \
  132. then \
  133. echo "Suspicious 'rm' invocation." 1>&2; \
  134. exit 1; \
  135. else :; fi
  136. # Never use something like "for file in $(FILES)", this doesn't work
  137. # if FILES is empty or if it contains shell meta characters (e.g. $ is
  138. # commonly used in Java filenames).
  139. sc_no_for_variable_in_macro:
  140. @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \
  141. echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \
  142. exit 1; \
  143. else :; fi
  144. # Make sure all invocations of mkinstalldirs are correct.
  145. sc_mkinstalldirs:
  146. @if grep -n 'mkinstalldirs' $(ams) \
  147. | grep -F -v '$$(mkinstalldirs)' \
  148. | grep -v '^\./Makefile.am:[0-9][0-9]*: *lib/mkinstalldirs \\$$'; \
  149. then \
  150. echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \
  151. exit 1; \
  152. else :; fi
  153. # Make sure all calls to PRE/NORMAL/POST_INSTALL/UNINSTALL
  154. sc_pre_normal_post_install_uninstall:
  155. @if grep -E -n '\((PRE|NORMAL|POST)_(|UN)INSTALL\)' $(ams) | \
  156. grep -v ':##' | grep -v ': @\$$('; then \
  157. echo "Found incorrect use of PRE/NORMAL/POST_INSTALL/UNINSTALL in the lines above" 1>&2; \
  158. exit 1; \
  159. else :; fi
  160. # We never want to use "undef", only "delete", but for $/.
  161. sc_perl_no_undef:
  162. @if grep -n -w 'undef ' $(automake_in) | \
  163. grep -F -v 'undef $$/'; then \
  164. echo "Found 'undef' in the lines above; use 'delete' instead" 1>&2; \
  165. exit 1; \
  166. fi
  167. # We never want split (/ /,...), only split (' ', ...).
  168. sc_perl_no_split_regex_space:
  169. @if grep -n 'split (/ /' $(automake_in) $(acloca_in); then \
  170. echo "Found bad split in the lines above." 1>&2; \
  171. exit 1; \
  172. fi
  173. # Look for cd within backquotes
  174. sc_cd_in_backquotes:
  175. @if grep -n '^[^#]*` *cd ' $(automake_in) $(ams); then \
  176. echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
  177. exit 1; \
  178. fi
  179. # Look for cd to a relative directory (may be influenced by CDPATH).
  180. # Skip some known directories that are OK.
  181. sc_cd_relative_dir:
  182. @if grep -n '^[^#]*cd ' $(automake_in) $(ams) | \
  183. grep -v 'echo.*cd ' | \
  184. grep -v 'am__cd =' | \
  185. grep -v '^[^#]*cd [./]' | \
  186. grep -v '^[^#]*cd \$$(top_builddir)' | \
  187. grep -v '^[^#]*cd "\$$\$$am__cwd' | \
  188. grep -v '^[^#]*cd \$$(abs' | \
  189. grep -v '^[^#]*cd "\$$(DESTDIR)'; then \
  190. echo "Consider using \$$(am__cd) in the lines above." 1>&2; \
  191. exit 1; \
  192. fi
  193. # Using @_ in a scalar context is most probably a programming error.
  194. sc_perl_at_uscore_in_scalar_context:
  195. @if grep -Hn '[^%@_A-Za-z0-9][_A-Za-z0-9]*[^) ] *= *@_' \
  196. $(automake_in) $(aclocal_in); then \
  197. echo "Using @_ in a scalar context in the lines above." 1>&2; \
  198. exit 1; \
  199. fi
  200. ## Allow only few variables to be localized in automake and aclocal.
  201. sc_perl_local:
  202. @if egrep -v '^[ \t]*local \$$[_~]( *=|;)' \
  203. $(automake_in) $(aclocal_in) | \
  204. grep '^[ \t]*local [^*]'; then \
  205. echo "Please avoid 'local'." 1>&2; \
  206. exit 1; \
  207. fi
  208. # Don't let AMDEP_TRUE substitution appear in automake.in.
  209. sc_AMDEP_TRUE_in_automake_in:
  210. @if grep '@AMDEP''_TRUE@' $(automake_in); then \
  211. echo "Don't put AMDEP_TRUE substitution in automake.in" 1>&2; \
  212. exit 1; \
  213. fi
  214. # Recursive make invocations should always pass $(AM_MAKEFLAGS)
  215. # to $(MAKE), for portability to non-GNU make.
  216. sc_tests_make_without_am_makeflags:
  217. @if grep '^[^#].*(MAKE) ' $(ams) $(automake_in) \
  218. | grep -Fv '$$(AM_MAKEFLAGS)'; \
  219. then \
  220. echo 'Use $$(MAKE) $$(AM_MAKEFLAGS).' 1>&2; \
  221. exit 1; \
  222. fi
  223. # Look out for some obsolete variables.
  224. sc_tests_obsolete_variables:
  225. @vars=" \
  226. using_tap \
  227. am_using_tap \
  228. test_prefer_config_shell \
  229. original_AUTOMAKE \
  230. original_ACLOCAL \
  231. parallel_tests \
  232. am_parallel_tests \
  233. "; \
  234. seen=""; \
  235. for v in $$vars; do \
  236. if grep -E "\b$$v\b" $(xtests) $(xdefs); then \
  237. seen="$$seen $$v"; \
  238. fi; \
  239. done; \
  240. if test -n "$$seen"; then \
  241. for v in $$seen; do \
  242. case $$v in \
  243. parallel_tests|am_parallel_tests) v2=am_serial_tests;; \
  244. *) v2=am_$$v;; \
  245. esac; \
  246. echo "Variable '$$v' is obsolete, use '$$v2' instead." 1>&2; \
  247. done; \
  248. exit 1; \
  249. else :; fi
  250. # Tests should never call some programs directly, but only through the
  251. # corresponding variable (e.g., '$MAKE', not 'make'). This will allow
  252. # the programs to be overridden at configure time (for less brittleness)
  253. # or by the user at make time (to allow better testsuite coverage).
  254. sc_tests_plain_check_rules = \
  255. sc_tests_plain_egrep \
  256. sc_tests_plain_fgrep \
  257. sc_tests_plain_make \
  258. sc_tests_plain_perl \
  259. sc_tests_plain_automake \
  260. sc_tests_plain_aclocal \
  261. sc_tests_plain_autoconf \
  262. sc_tests_plain_autoupdate \
  263. sc_tests_plain_autom4te \
  264. sc_tests_plain_autoheader \
  265. sc_tests_plain_autoreconf
  266. toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
  267. $(sc_tests_plain_check_rules): sc_tests_plain_% :
  268. @# The leading ':' in the grep below is what is printed by the
  269. @# preceding 'grep -v' after the file name.
  270. @# It works here as a poor man's substitute for beginning-of-line
  271. @# marker.
  272. @if grep -v '^[ ]*#' $(xtests) \
  273. | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[ ]*?$*\b'; \
  274. then \
  275. echo 'Do not run "$*" in the above tests.' \
  276. 'Use "$$$(call toupper,$*)" instead.' 1>&2; \
  277. exit 1; \
  278. fi
  279. # Tests should only use END and EOF for here documents
  280. # (so that the next test is effective).
  281. sc_tests_here_document_format:
  282. @if grep '<<' $(xtests) | grep -Ev '\b(END|EOF)\b|\bcout <<'; then \
  283. echo 'Use here documents with "END" and "EOF" only, for greppability.' 1>&2; \
  284. exit 1; \
  285. fi
  286. # Our test case should use the $(...) POSIX form for command substitution,
  287. # rather than the older `...` form.
  288. # The point of ignoring text on here-documents is that we want to exempt
  289. # Makefile.am rules, configure.ac code and helper shell script created and
  290. # used by out shell scripts, because Autoconf (as of version 2.69) does not
  291. # yet ensure that $CONFIG_SHELL will be set to a proper POSIX shell.
  292. sc_tests_command_subst:
  293. @found=false; \
  294. scan () { \
  295. sed -n -e '/^#/d' \
  296. -e '/<<.*END/,/^END/b' -e '/<<.*EOF/,/^EOF/b' \
  297. -e 's/\\`/\\{backtick}/' \
  298. -e "s/[^\\]'\([^']*\`[^']*\)*'/'{quoted-text}'/g" \
  299. -e '/`/p' $$*; \
  300. }; \
  301. for file in $(xtests); do \
  302. res=`scan $$file`; \
  303. if test -n "$$res"; then \
  304. echo "$$file:$$res"; \
  305. found=true; \
  306. fi; \
  307. done; \
  308. if $$found; then \
  309. echo 'Use $$(...), not `...`, for command substitutions.' >&2; \
  310. exit 1; \
  311. fi
  312. # Tests should no longer call 'Exit', just 'exit'. That's because we
  313. # now have in place a better workaround to ensure the exit status is
  314. # transported correctly across the exit trap.
  315. sc_tests_exit_not_Exit:
  316. @if grep 'Exit' $(xtests) $(xdefs) | grep -Ev '^[^:]+: *#' | grep .; then \
  317. echo "Use 'exit', not 'Exit'; it's obsolete now." 1>&2; \
  318. exit 1; \
  319. fi
  320. # Guard against obsolescent uses of ./defs in tests. Now,
  321. # 'test-init.sh' should be used instead.
  322. sc_tests_no_source_defs:
  323. @if grep -E '\. .*defs($$| )' $(xtests); then \
  324. echo "Source 'test-init.sh', not './defs'." 1>&2; \
  325. exit 1; \
  326. fi
  327. # Invocation of 'run_make' should not have output redirections.
  328. sc_tests_no_run_make_redirect:
  329. @if grep -Pzo '.*(\$$MAKE|\brun_make)\b(.*(\\\n))*.*>.*' $(xtests); \
  330. then \
  331. echo 'Do not redirect stdout/stderr in "run_make" or "$$MAKE"' \
  332. 'invocations,' >&2; \
  333. echo 'use "run_make {-E|-O|-M}" instead.' >&2; \
  334. exit 1; \
  335. fi
  336. # Use AUTOMAKE_fails when appropriate
  337. sc_tests_automake_fails:
  338. @if grep -v '^#' $(xtests) | grep '\$$AUTOMAKE.*&&.*exit'; then \
  339. echo 'Use AUTOMAKE_fails + grep to catch automake failures in the above tests.' 1>&2; \
  340. exit 1; \
  341. fi
  342. # "make -e" is brittle and unsafe, since it let *all* the environment
  343. # win over the macro definitions in the Makefiles. Since we offer
  344. # AM_MAKEFLAGS to allow the user to portably override macro definitions
  345. # from the command line in a safe way, we should encourage users to use
  346. # it.
  347. sc_tests_no_make_e:
  348. @if grep -E '\$$MAKE\b.* -[a-zA-Z0-9]*e' $(xtests); then \
  349. echo '"make -e" is brittle, use "run_make" instead.' 1>&2; \
  350. exit 1; \
  351. fi
  352. # Overriding a Makefile macro on the command line is not portable when
  353. # recursive targets are used. Better use an envvar. SHELL is an
  354. # exception, POSIX says it can't come from the environment. V, DESTDIR,
  355. # DISTCHECK_CONFIGURE_FLAGS and DISABLE_HARD_ERRORS are exceptions, too,
  356. # as package authors are urged not to initialize them anywhere.
  357. # Finally, 'exp' is used by some ad-hoc checks, where we ensure it's
  358. # ok to override it from the command line.
  359. sc_tests_overriding_macros_on_cmdline:
  360. # The first s/// tries to account for usages like "$MAKE || st=$?".
  361. # 'DISTCHECK_CONFIGURE_FLAGS' and 'exp' are allowed to contain whitespace in
  362. # their definitions, hence the more complex last three substitutions below.
  363. @if sed -e 's/ || .*//' -e 's/ && .*//' \
  364. -e 's/ DESTDIR=[^ ]*/ /' -e 's/ SHELL=[^ ]*/ /' \
  365. -e 's/ V=[^ ]*/ /' -e 's/ DISABLE_HARD_ERRORS=[^ ]*/ /' \
  366. -e "s/ DISTCHECK_CONFIGURE_FLAGS='[^']*'/ /" \
  367. -e 's/ DISTCHECK_CONFIGURE_FLAGS="[^"]*"/ /' \
  368. -e 's/ DISTCHECK_CONFIGURE_FLAGS=[^ ]/ /' \
  369. -e "s/ exp='[^']*'/ /" \
  370. -e 's/ exp="[^"]*"/ /' \
  371. -e 's/ exp=[^ ]/ /' \
  372. $(filter-out %/am-test-lib.sh,$(xtests)) \
  373. | grep '\$$MAKE .*='; then \
  374. echo 'Rewrite "$$MAKE foo=bar" as "run_make foo=bar" in the lines above,'; \
  375. echo 'it is more portable.'; \
  376. exit 1; \
  377. fi >&2
  378. @if grep 'SHELL=.*\$$MAKE' $(xtests); then \
  379. echo '$$MAKE ignores the SHELL envvar, use "run_make SHELL=$$SHELL"'; \
  380. echo 'in the above lines.'; \
  381. exit 1; \
  382. fi >&2
  383. # Prefer use of our 'is_newest' auxiliary script over the more hacky
  384. # idiom "test $(ls -1t new old | sed 1q) = new", which is both more
  385. # cumbersome and more fragile.
  386. sc_tests_ls_t:
  387. @if LC_ALL=C grep -E '\bls(\s+-[a-zA-Z0-9]+)*\s+-[a-zA-Z0-9]*t' \
  388. $(xtests); then \
  389. echo "Use 'is_newest' rather than hacks based on 'ls -t'" 1>&2; \
  390. exit 1; \
  391. fi
  392. # Never use 'sleep 1' to create files with different timestamps.
  393. # Use '$sleep' instead. Some file systems (e.g., Windows) have only
  394. # a 2sec resolution.
  395. sc_tests_plain_sleep:
  396. @if grep -E '\bsleep +[12345]\b' $(xtests); then \
  397. echo 'Do not use "sleep x" in the above tests. Use "$$sleep" instead.' 1>&2; \
  398. exit 1; \
  399. fi
  400. # fgrep and egrep are not required by POSIX.
  401. sc_m4_am_plain_egrep_fgrep:
  402. @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
  403. echo 'Do not use egrep or fgrep in the above files,' \
  404. 'they are not portable.' 1>&2; \
  405. exit 1; \
  406. fi
  407. # Prefer 'configure.ac' over the obsolescent 'configure.in' as the name
  408. # for configure input files in our testsuite. The latter has been
  409. # deprecated for several years (at least since autoconf 2.50).
  410. sc_tests_no_configure_in:
  411. @if grep -E '\bconfigure\\*\.in\b' $(xtests) $(xdefs) \
  412. | grep -Ev '/backcompat.*\.(sh|tap):' \
  413. | grep -Ev '/autodist-configure-no-subdir\.sh:' \
  414. | grep -Ev '/(configure|help)\.sh:' \
  415. | grep .; \
  416. then \
  417. echo "Use 'configure.ac', not 'configure.in', as the name" >&2; \
  418. echo "for configure input files in the test cases above." >&2; \
  419. exit 1; \
  420. fi
  421. # Rule to ensure that the testsuite has been run before. We don't depend
  422. # on 'check' here, because that would be very wasteful in the common case.
  423. # We could run "make check RECHECK_LOGS=" and avoid toplevel races with
  424. # AM_RECURSIVE_TARGETS. Suggest keeping test directories around for
  425. # greppability of the Makefile.in files.
  426. sc_ensure_testsuite_has_run:
  427. @if test ! -f '$(TEST_SUITE_LOG)'; then \
  428. echo 'Run "env keep_testdirs=yes make check" before' \
  429. 'running "make maintainer-check"' >&2; \
  430. exit 1; \
  431. fi
  432. .PHONY: sc_ensure_testsuite_has_run
  433. # Ensure our warning and error messages do not contain duplicate 'warning:' prefixes.
  434. # This test actually depends on the testsuite having been run before.
  435. sc_tests_logs_duplicate_prefixes: sc_ensure_testsuite_has_run
  436. @if grep -E '(warning|error):.*(warning|error):' t/*.log; then \
  437. echo 'Duplicate warning/error message prefixes seen in above tests.' >&2; \
  438. exit 1; \
  439. fi
  440. # Ensure variables are listed before rules in Makefile.in files we generate.
  441. sc_tests_makefile_variable_order: sc_ensure_testsuite_has_run
  442. @st=0; \
  443. for file in `find t -name Makefile.in -print`; do \
  444. latevars=`sed -n \
  445. -e :x -e 's/#.*//' \
  446. -e '/\\\\$$/{' -e N -e 'b x' -e '}' \
  447. -e '# Literal TAB.' \
  448. -e '1,/^ /d' \
  449. -e '# Allow @ so we match conditionals.' \
  450. -e '/^ *[a-zA-Z_@]\{1,\} *=/p' $$file`; \
  451. if test -n "$$latevars"; then \
  452. echo "Variables are expanded too late in $$file:" >&2; \
  453. echo "$$latevars" | sed 's/^/ /' >&2; \
  454. st=1; \
  455. fi; \
  456. done; \
  457. test $$st -eq 0 || { \
  458. echo 'Ensure variables are expanded before rules' >&2; \
  459. exit 1; \
  460. }
  461. # Using ':' as a PATH separator is not portable.
  462. sc_tests_PATH_SEPARATOR:
  463. @if grep -E '\bPATH=.*:.*' $(xtests) ; then \
  464. echo "Use '\$$PATH_SEPARATOR', not ':', in PATH definitions" \
  465. "above." 1>&2; \
  466. exit 1; \
  467. fi
  468. # Try to make sure all @...@ substitutions are covered by our
  469. # substitution rule.
  470. sc_perl_at_substs:
  471. @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' bin/aclocal | wc -l` -ne 0; then \
  472. echo "Unresolved @...@ substitution in aclocal" 1>&2; \
  473. exit 1; \
  474. fi
  475. @if test `grep -E '^[^#]*@[A-Za-z_0-9]+@' bin/automake | wc -l` -ne 0; then \
  476. echo "Unresolved @...@ substitution in automake" 1>&2; \
  477. exit 1; \
  478. fi
  479. sc_unquoted_DESTDIR:
  480. @if grep -E "[^\'\"]\\\$$\(DESTDIR" $(ams); then \
  481. echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \
  482. exit 1; \
  483. fi
  484. sc_tabs_in_texi:
  485. @if grep ' ' $(srcdir)/doc/automake.texi; then \
  486. echo 'Do not use tabs in the manual.' 1>&2; \
  487. exit 1; \
  488. fi
  489. sc_at_in_texi:
  490. @if grep -E '([^@]|^)@([ ][^@]|$$)' $(srcdir)/doc/automake.texi; \
  491. then \
  492. echo 'Unescaped @.' 1>&2; \
  493. exit 1; \
  494. fi