Hello GNU Makers,

Is there a way to find out if a variable is unset in a Makefile? The `ifdef' 
condtional directive appears to do something different from what it's name 
suggests.

Take for example this make snippet below:

ifdef DEBUG
# debug:=> /\S/
$(info DEBUG=[$(DEBUG)] debug mode ON.)
else
# debug:=> unset ||  /^$/ || /^\s+$/
$(info DEBUG=[$(DEBUG)] debug mode OFF.)
endif

Using GNU make version 4.0 we see that even if the variable is containing 
spaces or is null
the ifdef else portion is executed. 

My goal was to trigger the DEBUG evaluation in Makefile based on the state of 
the DEBUG variable. This can make from the environment (by way of: setenv 
DEBUG), from the command line (make DEBUG=     goal),  as defined inside the 
Makefile (DEBUG :=  1  ).

--Rakesh


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

Reply via email to