Hi Bruno, * Bruno Haible wrote on Fri, May 01, 2009 at 09:54:07PM CEST: > > If you need a blurb about this in some gnulib documentation then please > > show me where it would be appropriate; thanks. > > It's more in the automake documentation that I would expect this.
Good point, thanks. I'm pushing the patch below to Automake. > > OK to push? > > Without the .PHONY, please. If someone ever has an unintended overlap > between file names on disk and Makefile targets, he's better off renaming > one or the other, instead of relying on obscure 'make' features. Phony also has the advantage that it helps GNU make do some implicit rule searches (not in this case, as we provide commands, but in general). But I've removed it from the patch now. > Also I would rename the targets > install-exec-charset -> install-exec-localcharset > uninstall-charset -> uninstall-localcharset > because the name of the module is 'localcharset'. Done and pushed. Thanks for the review! Cheers, Ralf 2009-05-02 Bruno Haible <br...@clisp.org> Ralf Wildenhues <ralf.wildenh...@gmx.de> 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. 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