[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Setting Variables depending on target being made
From: |
Fabrice GIRARDOT |
Subject: |
Re: Setting Variables depending on target being made |
Date: |
Wed, 04 Jun 2008 15:33:11 +0200 |
User-agent: |
Thunderbird 2.0.0.12 (Windows/20080213) |
Hi Gary.
You're trying to set & export var MY_OPTS from a command
that Make will run for you.
Such commands are always run in a new separate environment.
This environment is deleted once the command is finish,
and so setting/exporting any var is useless.
(Check ยง 5.3 in Make's manual).
You should try something more simple :
----- start of makefile ------
.PHONY: cmp cmpDbg
MY_OPT1 = blaaa
MY_OPT2 = foooo
ifneq (,$(filter cmp,$(MAKECMDGOALS)))
# cmp is in Make's target(s)
MY_OPTS = $(MY_OPT1)
else
MY_OPTS = $(MY_OPT2)
endif
cmp: compile
cmpDbg: compile
compile:
@echo MY_OPTS=$(MY_OPTS)
@some_command > $@
----- end of makefile ------
Regards,
--
Fabrice GIRARDOT