help-make
[Top][All Lists]
Advanced

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

RE: Expanding PATH variable in dynamic way


From: Dave Korn
Subject: RE: Expanding PATH variable in dynamic way
Date: Thu, 1 Nov 2007 17:18:52 -0000

On 01 November 2007 13:41, Greg Chicares wrote:

> On 2007-11-01 06:21Z, 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.
> 
> Write the program's full path explicitly.

  Both Greg and Brian suggest modifying the build rule to specify the PATH.

  Which is fine as far as it goes, but doesn't necessarily help ElenaR if
she's relying on the implicit built-in rules.

  If you want to change the $PATH setting used by implicit rules, it might
work to add a pattern-specific definition.  For instance, to add /some/path to
$PATH whenever a C file is being compiled to an object file by an implicit
rule, you could try

%.o : PATH=/some/path:$(PATH)

  Alternatively, since the implicit rules always use a variable to specify the
compiler invoked, you can try redefining those to have a full path instead,
i.e.

CC:=/some/path/gcc
CXX:=/some/path/g++

etc.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....





reply via email to

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