help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get hostname in a Makefile?


From: gaoyong pan
Subject: Re: How to get hostname in a Makefile?
Date: Thu, 1 Apr 2010 09:41:57 +0800

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 <address@hidden>:
> 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
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make
>



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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]