bug-make
[Top][All Lists]
Advanced

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

Re: VPATH question


From: Paul Smith
Subject: Re: VPATH question
Date: Fri, 24 Feb 2023 13:01:39 -0500
User-agent: Evolution 3.46.4 (by Flathub.org)

On Fri, 2023-02-24 at 17:40 +0100, Gisle Vanem wrote:
> Paul Smith wrote:
> > If you use "-d" you'll get the info you want:
> > 
> >      No implicit rule found for 'default'.
> >      Considering target file 'lib'.
> >      Finished prerequisites of target file 'lib'.
> >      No need to remake target 'lib'; using VPATH name 'apps/lib'.
> >     Finished prerequisites of target file 'default'.
> > 
> > > Only adding 'MAKEFLAGS += --warn-undefined-variables' is somewhat
> > > helpful.
> > 
> > You should feel free to do that, if your makefiles are written such
> > that it doesn't give spurious warnings.  Make has silently expanded
> > empty variables to the empty string for 40 years and changing that
> > as the default behavior is not an option.
> 
> Ok thanks for the explanation. But I tend to use 'vpath %.c dir'
> more and more. It seems a lot faster too.

In my opinion it's just not a good idea to use directories as
prerequisites in makefile rules, period, with only very specific,
limited exceptions.

But, I realize that I'm in the distinct minority in this opinion and
that all the "hot new makefiles" tend to do this.  I'll stick to my old
fuddy-duddy opinions however.  Keep those directories off my lawn!

As for "it seems a lot faster", I have no comment since you don't say
what it seems faster than.  If you mean that "vpath %.c dir" is faster
than "VPATH = dir", then that's not surprising since the latter
searches "dir" for every single prerequisite while the former only
searches for prerequisites that match the pattern.

If you mean it's faster than listing the full pathname explicitly as a
prerequisite, then I can't believe that's the case.

Cheers!



reply via email to

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