[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Prerequisite variable expansion
From: |
Casey Liscum |
Subject: |
Prerequisite variable expansion |
Date: |
Tue, 19 Dec 2000 17:16:49 -0500 |
Variables involved in a target-specific modification do not expand to
the updated form when used as a prerequisite for that target. They do
expand properly when used in the rule's command structure.
Here is a simplified example Makefile:
-----
# initial target value set;
TARGETS = foo
# set target-specific value of ${TARGETS}
both : TARGETS += bar
# rules
both : ${TARGETS}
@echo TARGETS ARE: ${TARGETS}
foo bar :
@echo MAKING TARGET: $@
-----
and here is it's output:
-----
$ make both
MAKING TARGET: foo
TARGETS ARE: foo bar
-----
$(TARGETS) only expands to 'foo' when making, as noted by the lack of a
line 'MAKING TARGET: bar' in the output.
When $(TARGETS) is echoed in the command for 'both', however, it expands
to the value set by the target-specific modification.
I was looking over the documentation to find out if this is an actual
bug, but could not find anywhere that says _when_ in the makefile
target-specific variables are set. I assumed it was as they are read,
but this doesn't seem to be the case.
I've tested with make versions 3.77, 3.78, and 3.79.
I run the stable distribution of Debian GNU/Linux (potato).
Thanks!
--
Casey W. Liscum Computer Science, Drexel University
If puns were deli meat, this would be the wurst.
- Prerequisite variable expansion,
Casey Liscum <=