[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Expanding PATH variable in dynamic way
From: |
Brian Dessent |
Subject: |
Re: Expanding PATH variable in dynamic way |
Date: |
Thu, 01 Nov 2007 06:39:13 -0700 |
ElenaR wrote:
> in my makefile there're some rules which use external program call.
> The called program's binary is placed in some directory, that I doesn't want
> to place in PATH in a constant way,but only for comilation time.
You can do this the same way you would in a shell script, because that's
all that make is doing -- running fragments of shell script for each
target.
foo:
PATH="/some/where:$$PATH" some-prog --arg $@
You have to use $$ for variables that you want the shell to expand so
that make doesn't do the expansion. The modified value of PATH only
applies for that one command because modifications to a child's
environment have no effect on the parent process and are effectively
discarded when the child terminates.
But I don't really see why you need to change the PATH to accomplish
this, you could have accomplished the same thing with:
foo:
/some/where/some-prog --arg $@
The only reason I can see to modify the PATH is if some-prog itself
tries to spawn further child processes that are located in /some/where.
Brian