[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Conditional build
From: |
Paul D. Smith |
Subject: |
Re: Conditional build |
Date: |
Tue, 11 Apr 2006 13:50:40 -0400 |
%% "Andrew Small" <address@hidden> writes:
as> I need to switch a build between for ROM and RAM.
as> At the moment, I have a line near the top of the file:
as> RUNFROMFLASH=yes
as> and then:
as> ifeq ($(RUNFROMFLASH),yes)
as> # Run from Flash configuration files
as> PROGNAME = flashweb
as> NG_DEF += ,RTE_FLASH
as> OBJS += hwsetup.$(NGOEXT) sections.$(NGOEXT)
as> endif
as> a sub-makefile also switches the linker sections between ROM & RAM
as> depending on the value of RUNFROMFLASH.
as> This is OK, but I'd rather it was streamlined so that the makefile
as> itself did not need modifying to switch between build options.
Why not just run:
make RUNFROMFLASH=no
?
as> I tried prepending the .mk file with:
as> rom:
as> RUNFROMFLASH=yes
as> all
as> ram:
as> RUNFROMFLASH=no
as> all
Er... No.
The stuff after the TAB has to be _shell_ commands, not make commands.
That text is handed off to the shell as a shell script to be run. You
could write it like this:
rom:
$(MAKE) RUNFROMFLASH=yes all
ram:
$(MAKE) RUNFROMFLASH=no all
Or, you could use target-specific variables and avoid the need to invoke
make recursively.
See the GNU make manual for info on how to invoke make, how to write
rules, etc.
--
-------------------------------------------------------------------------------
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