bill wrote:
Thanks to everyone who responded to that question. I'm a little
confused about how to deal with the issue that the conditional
definition seems to occur too late. In the following example, I
modify the value of $(DIR) when the target is debug. But the target
$(DIR) maintains the old value. So when I "make debug", there is no
rule to build /tmp/debug. How do I make the conditional values be
targets?
% rmdir /tmp/foo % cat makefile
DIR = /tmp/foo
debug : DIR = /tmp/debug
all: $(DIR)
debug: all
$(DIR): mkdir -p $@ ...
You can't do that and have it work! All the rule definitions get parsed
and set when the Makefile is read. Hence the value of DIR used from the
Makefile is first read (/tmp/foo) is used to define the rule for $(DIR)
at the end of you Makefile.
My recommendation is that you live with the 'make DEBUG=1' style and
then set DIR based on an ifeq before any rules that use $(DIR). You
could use the MAKECMDGOALS that I also mentioned previously but to be
honest I think that would be odd, and the 'make DEBUG=1' style is an
idiom which most people understand.
John.
--
John Graham-Cumming
[EMAIL PROTECTED]
Home: http://www.jgc.org/
POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/
Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/
PGP key: http://www.jgc.org/pgp/
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make