bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use automake *-local hooks as prerequisites only


From: Ralf Wildenhues
Subject: Re: Use automake *-local hooks as prerequisites only
Date: Sat, 2 May 2009 09:31:20 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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  <address@hidden>
            Ralf Wildenhues  <address@hidden>

        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:
+
address@hidden
+clean-local: clean-local-check
+.PHONY: clean-local-check
+clean-local-check:
+        -rm -rf testSubDir
address@hidden 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]