[Top][All Lists]

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

Re: How could I help now?

From: Ramón García
Subject: Re: How could I help now?
Date: Fri, 28 Sep 2007 01:05:56 +0200

The reason for initializing automatic variables in  the function
reference_variable is that otherwise the tests failed. I apologize for
that. My knowledge about the make code is empirical, that is, based on
trial and error. What failed was a test that referenced an automatic
variable of a rule from another rule. With the change that you
suggest, this would be allowed if the referenced target has been
already processed, that is, it is before the referencing rule in the
depth first ordering. I made .OUT_OF_DATE evaluation cause automatic
variable expansion of the prerequisite, because some tests failed (or
at least I think so). So, for the requirements of .OUT_OF_DATE design,
ensuring that the descendant of a target (in the tree of dependencies)
have been expanded is enough. Anyway, in case of doubt just removing
the suspect lines and see if any of the tests fail should be enough.
The tests included reflect the intended usage, and thus if they don't
break the design does not need radical changes. Otherwise, important
features of the .OUT_OF_DATE design should be changed. Recall that the
intended way of using out of date based on changes of values of
variables requires (indirect) reference to automatic variables:

# content-key is a value that changes when the content of the current
target changes
# By default it is the MD5SUM of the current target.
target-cached content-key = ${shell md5sum $@ | awk '{print $$1}' }

# We define pseudo-targets named %.variable to represent variables.
# the content key is the value of the variable
%.variable: content-key = ${$*}

# A target is out of date if the prerequisite changed its content
.OUT_OF_DATE= ${changed-value $@,$<.sum,$<::content-key}

I think that this design has been discussed in the mailing list, but
the patch included contains Texinfo documentation that should be
enough to see how this was designed.


> Indeed you are exactly right.  My comment was because in the patch you
> sent there was some code to initialize the automatic variables for
> target A if there was a reference to $(A::var).  I don't think that this
> code is necessary, or even a good idea.  If the automatic variables are
> not initialized for A, then expanding $(A::<) (etc.) should yield the
> empty string, just like $< etc.
> Or, am I missing something?
> --
> -------------------------------------------------------------------------------
>  Paul D. Smith <address@hidden>          Find some GNU make tips at:
>  "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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