From ef20e28bf3b966bf4f0358099f38b70a30c12755 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Sat, 28 Jan 2012 13:23:16 +0100 Subject: [PATCH] maintcheck: fix real and spurious warnings * lib/Makefile.am (install-data-hook): Correctly quote $(DESTDIR) occurrences. * Makefile.am (install-exec-hook, uninstall-hook): Likewise. (autodiffs): Prefer '$(am__cd)' to plain 'cd', where warranted. * doc/Makefile.am ($(srcdir)/amhello-1.0.tar.gz): Likewise. Also, prefer using AC_SUBST'd $(abs_top_builddir) over obtaining it at runtime from $(top_builddir). * syntax-check.mk (sc_mkinstalldirs): Tweak to whitelist known harmless occurrences of the checked-against usages. (sc_no_for_variable_in_macro): Likewise. * tests/CheckListOfTests.am (maintainer-check-list-of-tests): Tweak to avoid spuriously triggering the 'sc_no_for_variable_in_macro' maintainer check. Prefer '$(am__cd)' to plain 'cd' when warranted. --- Makefile.am | 14 +++++++------- doc/Makefile.am | 6 +++--- lib/Makefile.am | 4 ++-- syntax-checks.mk | 8 +++++--- tests/CheckListOfTests.am | 5 +++-- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/Makefile.am b/Makefile.am index 20a3584..685cbd9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -56,16 +56,16 @@ install-exec-hook: @for p in $(bin_SCRIPTS); do \ f="`echo $$p|sed '$(transform)'`"; \ fv="$$f-$(APIVERSION)"; \ - rm -f $(DESTDIR)$(bindir)/$$fv; \ - echo " $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv"; \ - $(LN) $(DESTDIR)$(bindir)/$$f $(DESTDIR)$(bindir)/$$fv; \ + rm -f "$(DESTDIR)$(bindir)/$$fv"; \ + echo " $(LN) '$(DESTDIR)$(bindir)/$$f' '$(DESTDIR)$(bindir)/$$fv'"; \ + $(LN) "$(DESTDIR)$(bindir)/$$f" "$(DESTDIR)$(bindir)/$$fv"; \ done uninstall-hook: @for p in $(bin_SCRIPTS); do \ f="`echo $$p|sed '$(transform)'`"; \ fv="$$f-$(APIVERSION)"; \ - rm -f $(DESTDIR)$(bindir)/$$fv; \ + rm -f "$(DESTDIR)$(bindir)/$$fv"; \ done @@ -233,14 +233,14 @@ autodiffs: rev=$$1 dir=$$2 \ && echo "$@: will get files from revision $$rev" \ && git clone -q --depth 1 "$$am_gitdir" tmp \ - && cd tmp \ + && $(am__cd) tmp \ && git checkout -q "$$rev" \ && echo "$@: bootstrapping $$rev" \ && $(SHELL) ./bootstrap \ && echo "$@: copying files from $$rev" \ && makefile_ins=`find . -name Makefile.in` \ && (tar cf - configure aclocal.m4 $$makefile_ins) | \ - (cd .. && cd "$$dir" && tar xf -) \ + (cd .. && $(am__cd) "$$dir" && tar xf -) \ && cd .. \ && rm -rf tmp; \ }; \ @@ -250,7 +250,7 @@ autodiffs: && git --git-dir="$$am_gitdir" describe $$NEW_COMMIT >/dev/null \ && rm -rf $$outdir \ && mkdir $$outdir \ - && cd $$outdir \ + && $(am__cd) $$outdir \ && mkdir new old \ && get_autofiles_from_rev $$OLD_COMMIT old \ && get_autofiles_from_rev $$NEW_COMMIT new \ diff --git a/doc/Makefile.am b/doc/Makefile.am index ee5c439..a2dde22 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -71,10 +71,10 @@ dist_doc_DATA = $(srcdir)/amhello-1.0.tar.gz # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by # configure in tests/. $(srcdir)/amhello-1.0.tar.gz: $(amhello_sources) $(top_srcdir)/configure.ac - $(AM_V_GEN)abs_top_builddir=`cd '$(top_builddir)' && pwd` && \ - PATH="$$abs_top_builddir/tests$(PATH_SEPARATOR)$$PATH" && \ + $(AM_V_GEN): && \ + PATH="$(abs_top_builddir)/tests$(PATH_SEPARATOR)$$PATH" && \ export PATH && \ - cd $(srcdir)/amhello && \ + $(am__cd) $(srcdir)/amhello && \ ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL && \ AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE && \ AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF && \ diff --git a/lib/Makefile.am b/lib/Makefile.am index 2e6445b..a7c8295 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -51,8 +51,8 @@ EXTRA_DIST = gnupload gitlog-to-changelog install-data-hook: @$(POST_INSTALL) @for prog in $(dist_script_DATA); do \ - echo " chmod +x $(DESTDIR)$(scriptdir)/$$prog"; \ - chmod +x $(DESTDIR)$(scriptdir)/$$prog; \ + echo " chmod +x '$(DESTDIR)$(scriptdir)/$$prog'"; \ + chmod +x "$(DESTDIR)$(scriptdir)/$$prog"; \ done ## `test -x' is not portable. So we use Perl instead. If Perl diff --git a/syntax-checks.mk b/syntax-checks.mk index 4da3974..0f01114 100644 --- a/syntax-checks.mk +++ b/syntax-checks.mk @@ -198,15 +198,17 @@ sc_rm_minus_f: ## if FILES is empty or if it contains shell meta characters (e.g. $ is ## commonly used in Java filenames). sc_no_for_variable_in_macro: - @if grep 'for .* in \$$(' $(ams); then \ + @if grep 'for .* in \$$(' $(ams) | grep -v '/Makefile\.am:'; then \ echo 'Use "list=$$(mumble); for var in $$$$list".' 1>&2 ; \ exit 1; \ else :; fi ## Make sure all invocations of mkinstalldirs are correct. sc_mkinstalldirs: - @if grep -n 'mkinstalldirs' $(ams) | \ - grep -F -v '$$(mkinstalldirs)'; then \ + @if grep -n 'mkinstalldirs' $(ams) \ + | grep -F -v '$$(mkinstalldirs)' \ + | grep -v '^\./lib/Makefile.am:37: *mkinstalldirs \\$$'; \ + then \ echo "Found incorrect use of mkinstalldirs in the lines above" 1>&2; \ exit 1; \ else :; fi diff --git a/tests/CheckListOfTests.am b/tests/CheckListOfTests.am index c71c7fc..3fa51d3 100644 --- a/tests/CheckListOfTests.am +++ b/tests/CheckListOfTests.am @@ -41,11 +41,12 @@ maintainer-check-list-of-tests: dirs='$(test_subdirs)'; \ test -n "$$dirs" || dirs=.; \ ## List of tests on filesystem. Be careful to cater for VPATH builds too. - for ext in $(TEST_EXTENSIONS); do \ + test_extensions='$(TEST_EXTENSIONS)'; \ + for ext in $$test_extensions; do \ for dir in $$dirs; do \ ls $$dir/*$$ext 2>/dev/null; \ if test $(srcdir) != $(builddir); then \ - (cd $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \ + ($(am__cd) $(srcdir) && ls $$dir/*$$ext 2>/dev/null); \ fi; \ done; \ done | sed 's,^\./,,' | sort | uniq >$(am__tfs); \ -- 2.7.4