help-make
[Top][All Lists]
Advanced

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

Re: Regarding running shell script from Makefile


From: Paul Smith
Subject: Re: Regarding running shell script from Makefile
Date: Fri, 11 May 2007 15:04:09 -0400

On Fri, 2007-05-11 at 07:15 -0700, gshejin wrote:
> I am having a scenerio where in I have to execute a shell script from
> the Makefile. If I am exporting the path where the shell script is
> located in the PATH variable and then run the make the script get's
> executed. But if i am not exporting the path in the shell and then run
> the make it throws an error, some thing like this 

First, when in the world is PATH not exported?  I've never run across an
environment where PATH wasn't exported.

Anyway.  When you say "execute a shell script", do you mean using the
$(shell ...) function, or do you mean a normal command script make
invokes to update a rule?

If the latter, then exporting PATH in your makefile will definitely
work.  If the former, then it won't be enough, because variables that
are marked exported inside the makefile are only exported to command
scripts, not $(shell ...) functions.

To work around this you can use:

        $(shell PATH="$(PATH)" <command>)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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