bug-make
[Top][All Lists]
Advanced

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

Re: vpath's and included makefiles


From: Paul D. Smith
Subject: Re: vpath's and included makefiles
Date: Fri, 22 Jun 2001 10:01:08 -0400

%% address@hidden writes:

  th> So, vpath's don't seem to work for locating 'include' makefiles.  For
  th> example, you can't do this:

  th>    vpath %.d directory
  th>    -include src1.d src2.d src3.d

  th> Is this by design?

This is how it's implemented and documented, yes.  The manual says (in
``Including Other Makefiles''):

     If the specified name does not start with a slash, and the file is
  not found in the current directory, several other directories are
  searched.  First, any directories you have specified with the `-I' or
  `--include-dir' option are searched (*note Summary of Options: Options
  Summary.).  Then the following directories (if they exist) are
  searched, in this order: `PREFIX/include' (normally `/usr/local/include'
  (1)) `/usr/gnu/include', `/usr/local/include', `/usr/include'.

     If an included makefile cannot be found in any of these directories,
  a warning message is generated [...]

  th> Otherwise, any hints on how to go about adding this would be
  th> appreciated.  (Or consider this an enhancement request :) )

The only way to set the path for include files to be searched is via the
-I flag on the make command line.

  th> Also, there seems to be a bug hidden in the include code somewhere.
  th> Consider this makefile:  (m1.d does not exist)

  th>      -include m1.d
  th>      all: m1.d
  th>           @echo "Deps: $^"

  th> > gmake

  th> running make with the above makefile generates no output.  If you
  th> comment out the include statement, you get:

  th>      #-include m1.d
  th>      all: m1.d
  th>           @echo "DEPS: $^"

  th> > gmake
  th>    gmake: *** No rule to make target `m1.d', needed by `all'.  Stop.

  th> If a rule is added to build m1.d, then both Makefiles above seem
  th> to behave normally.

Yes, this is a long-standing nit.  There's even a commented-out test
case in the test suite that checks it.

I've tried twice to fix it, and every single time something else, more
important, broke and I reverted the changes.

Someday I'll figure it out.

I think there's already a bug open on this.

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