help-gplusplus
[Top][All Lists]
Advanced

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

Re: Question on Makefile


From: Paul D. Smith
Subject: Re: Question on Makefile
Date: 15 Mar 2005 20:37:15 -0500
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

%% Christian Christmann <plfriko@yahoo.de> writes:

  cc> I want to use some binaries in the Makefile 
  cc> which are located in the same directory as
  cc> the source code. When I want to call these
  cc> files just with their name, make is complaining
  cc> about not finding the files. When I add "./" to the
  cc> file name everthing works fine.

  cc> Are there any options for the Makefile to let
  cc> make search for files also in the current directory?

Make doesn't run programs: it runs /bin/sh and passes it the rule you've
written, and it's _/bin/sh_ that runs programs.  The shell, of course,
looks in the PATH variable to find binaries, so if "." is in your PATH
then they will be found in the current directory; if it's not, they
won't be.


Personally I _strongly_ recommend that you NOT rely on PATH, but rather
do exactly what you've done and invoke your programs using "./foo" if
they exist in the current directory.  Not only does this make it quite
obvious to people reading the makefile exactly what you intend, but it
solves issues with finding unintended versions of programs on PATH;
these can be quite confusing.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@gnu.org>          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]