automake
[Top][All Lists]
Advanced

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

Re: Expressing dependencies


From: Bruce Korb
Subject: Re: Expressing dependencies
Date: Sun, 04 Jan 2004 08:53:09 -0800

Laurence Finston wrote:

> The problem is that make makes certain assumptions that don't apply when CWEB
> is used. `ctangle <filename>.web' creates <filename>.c. Additional files can
> also be written. In 3DLDF, each <filename>.web also writes <filename>.h.
> [...] However, not all changes
> to a .web file cause the .c or .h file to differ from its previous version,
> while make assumes that a target file must be rebuilt if one of its
> prerequisites is newer.

This is the general problem where there is not a strict 1:1 mapping between
a primary source and the one and only build product.  Consider your .web file
to really be several source files tangled up into one source file (with some
pieces of it common to several derived files).  Make has no conceivable way
of disentangling effects without "ctangle" itself.  So, the only way to make
it work is to run ctangle, determine if the output has changed and, if so,
replace the product file(s) and touch a timestamp file.  Not especially hard:

  <source>-<tool>-stamp : <source>
     <move aside products>
     <tool> <source> && touch $@
     for <each product> ; do \
        if <product changed> ; \
        then rm <saved-product> ; \
        else mv <saved-product> <product> ; fi ; done

Of course, make itself does the out-of-date analysis before running any
commands.  Not much automake can do about that.  Perhaps a layered
approach where a special target first ensures that derived source files
are up to date, then it re-invokes make to ensure that final products
are all up to date.  Yummy.  That's not an automake issue, tho.




reply via email to

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