help-make
[Top][All Lists]
Advanced

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

Re: implementing emake's #pragma multi in GNU make?


From: Michael Stahl
Subject: Re: implementing emake's #pragma multi in GNU make?
Date: Fri, 08 Feb 2013 00:24:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2

On 07/02/13 08:20, Mark Galeck (CW) wrote:
> 2.  " Check out what happens if the secondary output is deleted, but
> the primary is not:"
> 
> "What happens" is:  you have just corrupted your build.  You have
> touched, indeed, deleted, some built files (not sources) and now you
> expect your incremental build to still work?  Of course it won't.
> The only recommended way to "clean up" if you need to, is to use
>> make clean

if the build system has generated a file, then it should be able to
re-generate it if needed; that's its job.  in the project i'm working
on, the full re-build following "make clean" takes several hours on a
contemporary laptop, which is what a lot of our contributors use.

there is also a more serious problem with just a dependency but no rule
for "bar": make will not re-build targets that depend on "bar", because
without a rule for "bar" make assumes that it's still up to date.  this
means that the make invocation that builds "foo" will not rebuild all
dependent files, and the next time you invoke make it will see that
"bar"'s timestamp is newer and _then_ build its dependents.

you could try something like

bar:
        true

but that doesn't work because it doesn't update "bar"'s timestamp and so
it may happen that "bar" is always older than "foo" and you get spurious
rebuilds.

so at a minimum what you will need is:

bar:
        touch $@

but then there are still 2 problems:

1) it's a totally spurious process invocation, which hurts a large
   project on Cygwin
2) if you _actually_ delete "bar" then this will do the wrong thing
   so you really should do this instead:

bar:
        $(if $(wildcard $@),touch $@,rm -f foo; echo "please rerun make"; exit 
1)

... which is correct but really silly and non-obvious.

IMHO the lack of a real "multi-target-rule" feature is a shortcoming of
GNU make.

regards,
 michael




reply via email to

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