From: Bruno Haible Date: Sat, 2 May 2009 07:26:58 +0000 (+0200) Subject: Recommend *-local hooks without commands, for extensibility. X-Git-Tag: v1.11~17 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=763de95bebe871a69b2e9378dca5a0db6834077b;p=platform%2Fupstream%2Fautomake.git Recommend *-local hooks without commands, for extensibility. * doc/automake.texi (Clean): Show how to write the clean-local extension with separate phony target. * tests/Makefile.am (clean-local-check): Practice what we preach by marking this phony. For consistency, rename from ... (check-clean-local): ... this. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 65271fd..2560eeb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2009-05-02 Bruno Haible + Ralf Wildenhues + + Recommend *-local hooks without commands, for extensibility. + * doc/automake.texi (Clean): Show how to write the clean-local + extension with separate phony target. + * tests/Makefile.am (clean-local-check): Practice what we preach + by marking this phony. For consistency, rename from ... + (check-clean-local): ... this. + 2009-04-28 Eric Blake scripts: normalize all timestamps to UTC diff --git a/doc/automake.texi b/doc/automake.texi index 324649d..09a5dd2 100644 --- a/doc/automake.texi +++ b/doc/automake.texi @@ -8123,6 +8123,17 @@ clean-local: -rm -rf testSubDir @end example +Since @command{make} allows only one set of rules for a given target, +a more extensible way of writing this is to use a separate target +listed as a dependency: + +@example +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: + -rm -rf testSubDir +@end example + As the GNU Standards aren't always explicit as to which files should be removed by which rule, we've adopted a heuristic that we believe was first formulated by Fran@,{c}ois Pinard: diff --git a/tests/Makefile.am b/tests/Makefile.am index 093dde5..09b979c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -737,8 +737,8 @@ EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS) # Each test case depends on defs, aclocal, and automake. check_SCRIPTS = defs defs-p aclocal-$(APIVERSION) automake-$(APIVERSION) -clean-local: check-clean-local - -check-clean-local: +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: -chmod -R u+rwx *.dir -rm -rf defs-p *.dir diff --git a/tests/Makefile.in b/tests/Makefile.in index 03d3874..3125d04 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -1327,9 +1327,9 @@ $(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am defs-p: defs Makefile.am sed 's,^AM_INIT_AUTOMAKE$$,&([parallel-tests]),' < defs >$@ -clean-local: check-clean-local - -check-clean-local: +clean-local: clean-local-check +.PHONY: clean-local-check +clean-local-check: -chmod -R u+rwx *.dir -rm -rf defs-p *.dir