help-make
[Top][All Lists]
Advanced

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

Re: Export PATH variable


From: Paul Smith
Subject: Re: Export PATH variable
Date: Mon, 02 May 2011 09:53:07 -0400

On Mon, 2011-05-02 at 19:15 +0530, Ajay Jain wrote:
> I have a Makefile in which I want to export the value of PATH variable
> (the SHELL variable). I then want that all my subsequent rules should
> just get the new path. Is there a method? I tried various ways, but
> none of them worked.

I'm not sure what you mean by "all my subsequent rules".

You can do it by simply setting the make variable PATH.  Read the
section of the make manual "Variables from the Environment".

If you want to be explicit about it you can use "export PATH", but this
is not strictly necessary if there was a PATH variable in make's
environment when it was started (and really, isn't there always?)

        PATH := /my/special/bin:$(PATH)
        all: ; @echo '$(PATH)'


However, this will take effect for ALL rules in the makefile not just
the "subsequent rules".  There's no way to do this with a single
invocation such that it takes effect for some rules but not others.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.net
 "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]