Make inherits the exported environment variables, so doing this will
make it work as expected.

export HOSTNAME
make

or

get the hostname by

TMP := $(shell hostname)

2010/4/1 Peng Yu <[email protected]>:
> Hi,
>
> I have the following makefile. The first echo statement doesn't print
> anything (just an empty line), the second echo print the path
> correctly. Could you let me know what is the correct way to get
> $HOSTNAME in a makefile?
>
>
> $ cat Makefile
> .PHONY: all
>
> TMP:=$(HOSTNAME)
> TMP1:=$(PWD)
>
> all:
>        echo $(TMP)
>        echo $(TMP1)
>
> Regards,
> Peng
>
>
> _______________________________________________
> Help-make mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/help-make
>



-- 
Best Regards
Linux user #384184
@ http://counter.li.org/


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

Reply via email to