[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: conditional macro definitions
From: |
Paul D. Smith |
Subject: |
Re: conditional macro definitions |
Date: |
Mon, 21 Nov 2005 16:04:37 -0500 |
%% bill <address@hidden> writes:
b> Thanks to everyone who responded to that question. I'm a little
b> confused about how to deal with the issue that the conditional
b> definition seems to occur too late. In the following example, I
b> modify the value of $(DIR) when the target is debug. But the
b> target $(DIR) maintains the old value. So when I "make debug",
b> there is no rule to build /tmp/debug. How do I make the
b> conditional values be targets?
You can't. Target-specific variables are not active except for inside
the command script.
You didn't mention this requirement in your previous examples; all you
said was you wanted to redefine CFLAGS based on whether you were
debugging or not. If you don't fully specify the problem you can't
expect suggested solutions to meet all your needs.
b> % rmdir /tmp/foo
b> % cat makefile
b> DIR = /tmp/foo
b> debug : DIR = /tmp/debug
This kind of thing just won't work.
If you want to change the directory that your objects are put in when
DEBUG is enabled, you will HAVE to use conditionals:
ifdef DEBUG
DIR = /tmp/debug
else
DIR = /tmp/foo
endif
BTW, you wouldn't be able to do this with Sun's syntax, either.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist