Home > Archive > Unix Programming > July 2004 > how to pass macro definition from parent makefile to child makefile
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to pass macro definition from parent makefile to child makefile
|
|
|
| Hi,
I need to write 2 makefile, say a.mk and b.mk. 'a.mk' is the main entrance,
and the macros are set in it. Some rules are defined in b.mk. For example,
the rules for TargetB.
#a.mk
CFG = Release
TargetB:
$(MAKE) -f b.mk $@
#b.mk
TargetB:
$(BLD_CMD)
But I want to pass $CFG from a.mk to b.mk. How to do this?
Thanks,
Liang
| |
| Jens.Toerring@physik.fu-berlin.de 2004-07-20, 3:57 am |
| Liang <leo2002chen@hotmail.com> wrote:
> I need to write 2 makefile, say a.mk and b.mk. 'a.mk' is the main entrance,
> and the macros are set in it. Some rules are defined in b.mk. For example,
> the rules for TargetB.
> #a.mk
> CFG = Release
> TargetB:
> $(MAKE) -f b.mk $@
> #b.mk
> TargetB:
> $(BLD_CMD)
> But I want to pass $CFG from a.mk to b.mk. How to do this?
Add a line like
export CFG
or, putting assignment and exporting in a single line,
export CFG = Release
to a.mk, then it becomes visible in sub-makefiles
Regards, Jens
--
\ Jens Thoms Toerring ___ Jens.Toerring@physik.fu-berlin.de
\__________________________ http://www.toerring.de
|
|
|
|
|