From 763de95bebe871a69b2e9378dca5a0db6834077b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 2 May 2009 09:26:58 +0200 Subject: [PATCH] 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 --- ChangeLog | 10 ++++++++++ doc/automake.texi | 11 +++++++++++ tests/Makefile.am | 6 +++--- tests/Makefile.in | 6 +++--- 4 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 65271fd1e..2560eebc9 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 324649d7f..09a5dd270 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 093dde532..09b979ca8 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 03d387434..3125d0487 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 -- 2.47.2