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,
ChrisI 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.
精彩评论