help-make
[Top][All Lists]
Advanced

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

RE: Creating directories for VPATH to search


From: Norman Wilson
Subject: RE: Creating directories for VPATH to search
Date: Fri, 6 Jan 2006 13:49:53 -0000

I down loaded beta4 and looked at the code. Yes, make explicitly checks
that a directory exists before adding it to vpath. I hacked around the
check and my makefile now works. So if you wanted to add this feature it
would be very simple to implement. However your suggestion of forcing
the directory creation is probably a better solution in the short term.
I'd just figured this out for myself before reading your mail.

> -----Original Message-----
> From: Paul Smith [mailto:address@hidden On Behalf Of Paul D. Smith
> Sent: 06 January 2006 13:42
> To: Norman Wilson
> Cc: address@hidden
> Subject: Re: Creating directories for VPATH to search
> 
> %% "Norman Wilson" <address@hidden> writes:
> 
>   nw> Consider:
>   nw> VPATH = .:other
> 
>   nw> foo: bar
>   nw>         ln -s $(<) $(@)
> 
>   nw> other/bar: | other
>   nw>         touch $(@)
> 
>   nw> other:
>   nw>         mkdir $(@)
> 
>   nw> So, I'm saying if you don't find a file in the current directory
>   nw> look in other. The top level target requires bar. I give a rule
>   nw> for creating bar under other. I also give rule for 
> creating other.
> 
>   nw> I'd expect make to see that there is no bar in the current
>   nw> directory, see that there is a rule for creating it under other,
>   nw> and that other is in the VPATH, and therefore work out that
>   nw> other/bar must be created and then used as the prereq for foo.
> 
> No, that's not how make works.  Directories in VPATH are not 
> "implicit";
> that is, they don't participate in rule chaining.
> 
>   nw> If other exists then this makefile has the desired affect. If
>   nw> other does not exist I get:
> 
>   nw> make: *** No rule to make target `bar', needed by `foo'.  Stop.
> 
> You can use an alternative method of directory creation; this 
> is what I
> always use rather than order-only prereqs:
> 
>     _dummy := $(shell [ -d other ] || mkdir -p other)
> 
> Now, the directory will be created as the makefile is read in, well
> before make starts looking for targets to build.  The 
> advantage of this
> is (a) you don't have to use o-o prereqs (which you might 
> forget to add
> to some important target), and (b) make works properly in situations
> such as you describe.
> 
> The disadvantage is that the directory will always be created when you
> run make, even if none of the targets are built that would otherwise
> need it.
> 
>   nw> Is this fixed in the beta release?
> 
> It's not a bug (at least I don't consider it a bug).  It's 
> how make has
> always worked and it follows the documentation, and conforms to the
> behavior of other versions of make that support VPATH.
> 
> You can file an enhancement request on Savannah though if you like.
> 
> -- 
> --------------------------------------------------------------
> -----------------
>  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
> 
> 


=================================
Atos Euronext Market Solutions Disclaimer
=================================
The information contained in this e-mail is confidential and solely for the 
intended addressee(s). Unauthorised reproduction, disclosure, modification, 
and/or distribution of this email may be unlawful.
If you have received this email in error, please notify the sender immediately 
and delete it from your system. The views expressed in this message do not 
necessarily reflect those of Atos Euronext Market Solutions.

L'information contenue dans cet e-mail est confidentielle et uniquement 
destinee a la (aux) personnes a laquelle (auxquelle(s)) elle est adressee. 
Toute copie, publication ou diffusion de cet email est interdite. Si cet e-mail 
vous parvient par erreur, nous vous prions de bien vouloir prevenir 
l'expediteur immediatement et d'effacer le e-mail et annexes jointes de votre 
systeme. Le contenu de ce message electronique ne represente pas necessairement 
la position ou le point de vue d'Atos Euronext Market Solutions.





reply via email to

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