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



_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to