help-make
[Top][All Lists]
Advanced

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

Re: order-only dependency and transitivity


From: Ross Boylan
Subject: Re: order-only dependency and transitivity
Date: Wed, 9 Jun 2004 22:40:50 -0700
User-agent: Mutt/1.5.5.1+cvs20040105i

On Thu, Jun 10, 2004 at 12:49:49AM -0400, Paul D. Smith wrote:
> %% Ross Boylan <address@hidden> writes:
> 
>   >> $(SOURCES): m.touch
>   >> 
>   >> m.touch: m.web
>   >>        ftangle -F m.web
>   >>        @touch $@
>   >> 
>   rb> Thank you; that seems to work. Two questions/comments:
> 
>   rb> First, this violates rule 2 of your own tips
>   rb> http://make.paulandlesley.org/rules.html.  Should I be concerned?
> 
> I don't think it violates my rule... What did you have in mind?


"Every non-.PHONY rule must update a file with the exact name of its target."

$(SOURCES) is the target in the line
$(SOURCES): m.touch
yet the $(SOURCES) are not updated by the rule.  Further, at least
some members of $(SOURCES) are likely not to be updated by actions of
other rules (the one for m.touch) in the makefile (specifically,
ftangle -F).

But perhaps since this rule only expresses a dependency, and there are
no other rules with $(SOURCES) targets, we're in a different ballpark.

> 
>   rb> Though I didn't have that rule specifically in mind, I did think I'd
>   rb> get in some trouble if some of $(SOURCES) were permanently older than
>   rb> m.touch.  Apparently not...
> 
>   rb> Second, can anyone explain why my original example didn't work?  Is it
>   rb> a bug?
> 
> Depends on how you look at it.  In one sense it's not a bug, because
> you're changing the filesystem behind make's back: that is you're
> creating files that make cares about (that are targets in the makefile),
> without telling make about it.  GNU make has a directory cache it keeps
> internally, for efficiency's sake.  Due to this, files that are added to
> the directory behind make's back aren't in the cache and make can't see
> them.

Ah.  I didn't know such caching was going on.  Does the "behind the
back" ness derive from the fact that the files do not appear in the
command line for ftangle, or in the fact that the relevant rule
doesn't list them as targets?

> 
> The cache causes enough people problems that I'm considering adding a
> way to disable it (probably a pseudo target in your makefile) so that
> people who need to do tricky things like this can do so, but they will
> pay the performance penalty of not having the cache available.
> 
It might be useful at least to document it.  I didn't notice any
mention of it in the make info pages, and there is no index entry for
cache or caching.

In my particular case it seems there is a solution that doesn't
require disabling the cache.

A final general comment on the documentation: I couldn't tell from it
exactly when out-of-dateness was determined.  For example, it could be
done once before the makefile is processed; it could be done just at
the time a rule is checked; it could be done some other way.  It would
be very helpful to say explicitly how this happens.  I suppose the
caching makes that a little tricky.

Thanks for your help.




reply via email to

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