help-make
[Top][All Lists]
Advanced

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

Re: help: makefile: directory rules


From: Paul D. Smith
Subject: Re: help: makefile: directory rules
Date: Mon, 20 Mar 2006 11:34:17 -0500

%% Greg Chicares <address@hidden> writes:

  gc> On 2006-3-17 2:41 UTC, paulur wrote:
  >> There are two directories /src1 and /src2 where the soruce codes are, and
  >> another directory /headers for head files.
  >> 
  >> How should the makefile set variables ( not to hard code all the
  >> directories) so that the complier can find these files?

  gc> Let's say those are all subdirectories of /somepath/ and
  gc> assume you're using C. If you write

  gc> vpath %.c /somepath/src1 /somepath/src2
  gc> vpath %.h /somepath/headers

  gc> then you can run 'make' in a completely different directory
  gc> and it will find those files.

Yes but the OP was asking what to set so the _compiler_ can find those
files.


That's a function of your compiler, and not at all related to make.
Typically you would add -I<somepath> to your compile line, and that
means modifying a make variable that contains options provided to your
compiler.


Without knowing anything about your makefile environment there's not
much more we can say.  But please don't send your entire makefile
environment: we're not able to examine/debug something like that.
You'll need to learn enough makefile syntax to be able to ask shorter,
targeted questions.  The GNU make manual is an excellent resource for
learning about makefiles.

-- 
-------------------------------------------------------------------------------
 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]