开发者

Makefile losing access to environment variables

I've got a Makefile which has a couple of targets (all, install, uninstall). I'm trying to use the $JAVA_HOME environment variable, which works perfect in the all target, but when the install target is executed, the $JAVA_HOME variable seems to be empty (although it is not - I have checked in the terminal). Does anyone开发者_Go百科 have any ideas?

all:
        # This works good
        @echo ${JAVA_HOME}


ifeq ($(UNAME), Linux)
install:
        # This prints a blank line.
        @echo ${JAVA_HOME}
        # Doing stuff here

uninstall:
        # Doing stuff here
endif

Thanks,

Chris


I don't see a problem with what you have posted, but the way you set up JAVA_HOME before calling make may be the contributing factor. Are you using export to create the environment variable? If not, the make process might not be inheriting that part of the environment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜