[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: basename function does nothing when it appears in prerequisites
From: |
Matt Swift |
Subject: |
Re: basename function does nothing when it appears in prerequisites |
Date: |
10 Sep 2001 02:12:28 -0400 |
User-agent: |
Gnus/5.090001 (Oort Gnus v0.01) Emacs/20.7 |
>> On Sun, 9 Sep 2001 16:18:15 -0400, Paul D Smith <address@hidden> wrote:
P> In this case, what is basename of "%"? Just "%" itself, so you end up
P> with this:
P> foo.xx: %: %
Thank you for the clear explanation.
It is not the first time you have provided one for me! My memory is
short, but my files are long. We had a long and illuminating
corespondence on very similar matters in feb-mar 1999, though of
course I did not recognize the current issue as similar until now --
the truth about % seems to drain from my head over time.
I have two further comments.
1) In our previous correspondence you explained how the design of make
forbids using % in variables and function arguments. It does seem
to me, however, that a makefile like the following could be
processed sequentially in one pass without ambiguity. It seems to
me that $(remote-%-home) could in fact be resolved more easily than
make-%-manifests, which make does resolve. Perhaps the difficulty
is in distinguishing the OK cases from the problematic ones. I
don't need a reply to this, it is just a thought after reviewing
our corresondence on the general issue.
remote-data-home = buzz # or := if better
remote-web-home = booze
remote-lists-home = boss
targets = data web lists
$(addsuffix .test, $(targets)): %.test: make-%-manifests $(remote-%-home)
2) On behalf of those with short memories like mine, I have the
following suggestions for emending the Make manual.
The top of node "Functions" in make.info (4 April 2000) says this:
"Functions" allow you to do text processing in the makefile to
compute the files to operate on or the commands to use. You use a
function in a "function call", where you give the name of the function
and some text (the "arguments") for the function to operate on. The
result of the function's processing is substituted into the makefile at
the point of the call, just as a variable might be substituted.
The phrase "at the point of the call" is ambiguous (it could be time
or space). Neither interpretation adds any information -- when or
where else could the substitution be? I suggest the following revised
final sentence. You may find it too verbose; what I think is
important is the cross-reference. (I'm not sure how the text of the
cross-ref should/does read in texinfo format, though.)
The result of the function's processing is substituted into the
makefile [*] when `make' expands the construct in which it appears.
Some constructs are expanded when `make' first reads the makefile
and others are expanded later. (For details, see *note How `make'
Reads a Makefile: Reading Makefiles.)
[*] If you think retaining mention of the "point in space" is
important, I suggest adding "where the function appears" here.
I also recommend adding a cross reference to the "Reading Makefiles"
node somewhere in this paragraph in the node "Pattern Rules":
Note that expansion using `%' in pattern rules occurs *after* any
variable or function expansions, which take place when the makefile is
read. *Note How to Use Variables: Using Variables, and *Note Functions
for Transforming Text: Functions.
You might consider adding a sentence like the following, which
explains the consequences: `%' in a pattern rule is therefore treated
as a literal `%' when it appears in a function argument or variable
name.