[Top][All Lists]

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

Re: include ... why not search in same directory ?

From: Paul D. Smith
Subject: Re: include ... why not search in same directory ?
Date: Thu, 17 Apr 2003 15:11:35 -0400

%% "Markus Mauhart" <address@hidden> writes:

  >> You can use the $(MAKEFILES) variable, if you have GNU make 3.80.

  mm> you mean ...

  mm> include $(dir $word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))/

Yes (sans typo :)).

  mm> this can only be used up to the 1st include; then one needs file-local
  mm> variables, that is with a kind of unique name ... IMHO a very expensive
  mm> and unreadable instrumentarium.

Add this to the top of your makefile (maybe in a general included

  __FILE__ := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))

Then just use __FILE__ from then on.

  >> , then no.  This behavior has been around forever and make is too basic
  >> a tool to introduce these kinds of major incompatibilities with previous
  >> versions.

  mm> Understandable; allthough I'm not convinced that this fix of a
  mm> mis-feature would have to introduce more major incompatibilities
  mm> than many other changes that happened through make's history.

Like what?  There is virtually _never_ a change which is not
backward-compatible.  Possibly some changes might not be backward
compatible if you're using very bizarre types of syntax, like filenames
consisting of nothing but the character "|" or similar.

Were you thinking of something in particular?

A change like this is _VERY_ visible.  Any time someone uses -f
foo/ and has an include that is expected to be in the
current working directory, that would break.

In one of my build systems right now, for example, each directory has a
special makefile "" that describes that directory.  When make is
invoked it is run like this:

  make -f $(TOPDIR)/mk/

and inside the file it includes "".  This works
because it searches the current working directory even though the file is not local.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "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]