can we undefine/unset a variable in makefile

Viewed 16408

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 .

3 Answers
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

You have to give the NAME of the variable to undefine. Make will expand the argument to undefine so if the variable ENV_VAR_TEST is set to the value foo, then undefine ${ENV_VAR_TEST} runs undefine foo.

You want to use undefine ENV_VAR_TEST.

Related