This has plagued me on and off for years. Can anyone explain why $(HOSTNAME)
doesn't expand to the environment value HOSTNAME? Googling various combinations of "make", "hostname", "gmake", "not set" and so forth hasn't been fruitful for me.
jcomeau@intrepid:/tmp$ set | egrep 'HOSTNAME|USER'
HOSTNAME=intrepid
USER=jcomeau
jcomeau@intrepid:/tmp$ cat Makefile
%.test:
set | grep $*
%.env:
echo $($*)
jcomeau@intrepid:/tmp$ make HOSTNAME.test
set | grep HOSTNAME
BASH_EXECUTION_STRING='set | grep HOSTNAME'
HOSTNAME=intrepid
jcomeau@intrepid:/tmp$ make HOSTNAME.env
echo
jcomeau@intrepid:/tmp$ make USER.test
set | grep USER
BASH_EXECUTION_STRING='set | grep USER'
USER=jcomeau
jcomeau@intrepid:/tmp$ make USER.env
echo jcomeau
jcomeau