简体   繁体   中英

Can make determine whether an environment variable is defined?

AFAICT, ifdef in make works only for variables defined in the Makefile. Is there a way to check whether an environment variable is defined?

I don't know what you're doing (it's always best to include an actual example of what you have tried) but it definitely works:

$ cat Makefile
ifdef FOO
$(info FOO is defined)
endif
all:;@:

$ make

$ FOO=1 make
FOO is defined

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM