Team,
I have an environment variable which i would like to undefined/unset during the compilation of that particular project and then enable that back..
i have tried using.. the below code..
ifdef ${ENV_VAR_TEST}
undefine ${ENV_VAR_TEST}
endif
but i still see that its get reflected in the compilation environment... are these correct steps to undefined/unset a variable ?..i am i missing some basics here..
Thanks for your time .
Check if variable is defined in a Makefilecheck_defined = \ $(strip $(foreach 1,$1, \ $(call __check_defined,$1,$(strip $(value 2))))) __check_defined = \ $(if $(value $1),, \ $(error Undefined $1$(if $2, ($2)))) install: $(call check_defined, var1) $(call check_defined, var2) # do stuff here..
The ifeq directive begins the conditional, and specifies the condition. It contains two arguments, separated by a comma and surrounded by parentheses. Variable substitution is performed on both arguments and then they are compared.
unexport ENV_VAR_TEST
I don't know what the others mean by undefine
, which doesn't look like valid make
syntax.
Edit: undefine
exists indeed, but only in GNU make 3.82 and higher.
The correct syntax is
undefine ENV_VAR_TEST
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With