[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: May be bug in export PATH and $(shell ...).
From: |
Philip Guenther |
Subject: |
Re: May be bug in export PATH and $(shell ...). |
Date: |
Fri, 11 Jun 2010 15:02:46 -0700 |
On Fri, Jun 11, 2010 at 1:29 AM, Oleksandr Gavenko <address@hidden> wrote:
> Just do:
>
> $ mkdir test
> $ cat <<EOF >test/test.sh
> #!/bin/sh
> echo I am HERE
> EOF
(Missing a "chmod +x test/test.sh here, but that doesn't really affect
your point...)
> $ cat <<EOF >Makefile
(Should quote EOF or else the shell will try to expand $(PATH) as a
command substitution in the here-doc, but again, that doesn't really
affect your point...)
> export PATH := test:$(PATH)
> $(shell test.sh)
> all:
> test.sh
> EOF
> $ make
> make: temp.sh: Command not found # from $(shell ...)
> temp.sh
> I am HERE # from target command
>
>
> So export PATH work for spawned process under target command and don't work
> for $(shell ...).
I can't fix it in the C bits, but you can work around this at the
Makefile level: replace the $(shell test.sh) line with this:
shll = $(shell PATH=${PATH} $1)
$(call shll,test.sh)
You can use $(shll) over and over again.
Philip Guenther