[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Regarding running shell script from Makefile
From: |
Dave Korn |
Subject: |
RE: Regarding running shell script from Makefile |
Date: |
Mon, 14 May 2007 13:20:43 +0100 |
On 14 May 2007 12:30, Paul Smith wrote:
> On Mon, 14 May 2007 11:52:59 +0100, Dave Korn wrote:
>> export PATH:=/myhome/tools/bin:$PATH
>
> This is not correct. You need to use the make variable $(PATH), not the
> shell variable $PATH, since you're in a makefile:
>
> export PATH := /myhome/tools/bin:$(PATH)
Well, it does work and I did actually try it and all shell variables are
imported at the start of a makefile and you are allowed to use {} to refer to
a makefile variable according to the manual:
-----------------------------<make.info>-----------------------------
6.1 Basics of Variable References
=================================
To substitute a variable's value, write a dollar sign followed by the
name of the variable in parentheses or braces: either `$(foo)' or
`${foo}' is a valid reference to the variable `foo'.
-----------------------------<make.info>-----------------------------
and there are many examples in the manual that use curly braces, such as
-----------------------------<make.info>-----------------------------
6.2 The Two Flavors of Variables
================================
. . . . .
ifeq (0,${MAKELEVEL})
whoami := $(shell whoami)
host-type := $(shell arch)
MAKE := ${MAKE} host-type=${host-type} whoami=${whoami}
endif
-----------------------------<make.info>-----------------------------
So here's the test I ran:
-----------------------------<test case>-----------------------------
/tmp/makef $ ls
makefile
/tmp/makef $ cat makefile
export PATH:=${PATH}:/tmp
all:
@echo foo
hello > $@ ; echo >> $@
/tmp/makef $ hello
bash: hello: command not found
/tmp/makef $ /tmp/hello
Hello, Uranus!
/tmp/makef $ make
foo
hello > all ; echo >> all
/tmp/makef $ cat all
Hello, Uranus!
/tmp/makef $
-----------------------------<test case>-----------------------------
Am I missing something?
cheers,
DaveK
--
Can't think of a witty .sigline today....