[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gmake and passing variables
From: |
Paul D. Smith |
Subject: |
Re: gmake and passing variables |
Date: |
Wed, 31 Oct 2001 09:32:42 -0500 |
%% Joerg Krautwurst-Schmid <address@hidden> writes:
jk> I use gmake to call another build process (ant) to compile and
jk> build java classes. Now I want to pass a special option (e.g
jk> debug) to ant. But I don't know how to do this ? Is there a
jk> chance to pass options from the commandline and handle them in the
jk> Makefile or do I have to use environment variables to do this and
jk> check if the variable is set etc.
The only way to do this is by setting a make variable on the command
line.
For example, suppose your makefile has:
ANT = ant
ANTFLAGS = -foo
... $(ANT) ($ANTFLAGS) -o $@ $<
(note I completely made up this syntax, I don't know anything about ant :)
Then, you could invoke make as:
make ANTFLAGS='-foo -bar'
to override that setting and change the flags passed to ant. You don't
have to test for this at all: command-line variable settings always take
precedence over variable settings in the makefile.
See the GNU make manual, section "Overriding Variables".
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://www.paulandlesley.org/gmake/
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist