bug-gnulib
[Top][All Lists]
Advanced

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

Re: make -q and maintainer-makefile issues?


From: Paul Eggert
Subject: Re: make -q and maintainer-makefile issues?
Date: Sun, 14 Aug 2011 21:22:16 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110617 Thunderbird/3.1.11

On 08/14/2011 03:50 PM, Bruno Haible wrote:
> What is the difference between your test case
> 
> ---------------------------------
> all: foo
> foo: /etc/motd
>       cat /etc/motd >$@
> ---------------------------------
> 
> and the snippet from modules/relocatable-prog
> 
> ---------------------------------------
> uninstall-hook: uninstall-relocwrapper
> uninstall-relocwrapper:
>       some-statements;
> ---------------------------------------

My test case creates the file 'foo', but the snippet does not create a
file 'uninstall-relocwrapper'.

> and the pattern from po/Makefile.in.in:
> 
> ---------------------------------
> all : sanity
> all : foo
> sanity :
>       @test `expr 1 + 1` = 2
> foo :
>       echo > foo
> ---------------------------------

Similarly, my test case creates a file 'foo', but the 'sanity' rule
does not create a file 'sanity'.

>> If you can program a sanity check this way:
>>
>> sanity:
>>      @$(SANITY)
>>
>> where SANITY expands to the empty string if the check succeeds,
>> and to 'false' if it fails, then 'make -q' should work.  This is
>> true regardless of whether 'sanity' is phony.
> 
> An interesting idea. But in the special case of po/Makefile.in.in
> I cannot use it, without making use of GNU make $(...) function call
> expressions.

Can the sanity check be expressed as an Automake conditional?
That might do the trick.  (On the other hand, does gnulib
require Automake?)

Another possibility is to use a prefix +, like this:

all: sanity foo
sanity:
        address@hidden `expr 1 + 1` = 2
foo:
        touch $@

The '+' feature is something I wasn't aware of until just now.  It is
standardized by POSIX, but was not in Unix version 7.  I don't know
how portable it is in practice; I wouldn't recommend it unless we do
reasonably-extensive portability testing.  (It is not suitable for all
sanity checks; just for side-effect-free checks that do not depend on
anything other than other sanity checks.)

All in all, the approach taken in the gnulib now may be more
straightforward and portable than these alternatives.




reply via email to

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