help-make
[Top][All Lists]
Advanced

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

Re: Merging rules


From: Sébastien Hinderer
Subject: Re: Merging rules
Date: Thu, 14 Jun 2018 14:27:55 +0200

Dear Paul,

Many thanks for your clear, prompt and helpful response!

Paul Smith (2018/06/14 08:19 -0400):
> On Thu, 2018-06-14 at 13:51 +0200, Sébastien Hinderer wrote:
> > Now I am wondering whether there would be a way to rewrite this
> > fragment without having to repeat the command.
> 
> No, there is no way to do that.
> 
> Well, you could define a variable containing the rule and use an
> eval/call pair inside a foreach loop but I'm not convinced that would
> be more understandable or readable than what you have.

Ah, it's too bad. Because, what I forgot to mention is that the intent
behind all this is to make the recipe(s) a bit more complex by adding
other variables, namely CFLAGS and CPPFLAGS, to let the user (the
person who compiles the package) use them when desired.

I that light, and to guarantee that all the rules are consistent, do you
think it would become worth defining a marco that takes as only argument
the pattern of the target?

> > My interpretation of why this happens is that the rule has been
> > invoked once, to build the regular .o files, and then make believes
> > that this single invocation has built all the targets, which is
> > actually not the case.
> 
> Your interpretation is correct.  Using multiple pattern targets tells
> make that one invocation of the recipe will build _all_ the targets. 
> Once make believes it's run a recipe to build a target, it will never
> try again even if the resulting target wasn't actually built, or wasn't
> updated.

OK great, so at least I kind of start to understand a bit of soemthing.
Thanks a lot for having confirmed.

Just to make sure: do you confirm that it wouldn't be possible to
achieve the desired result through suffix rules?

> This is important behavior and is used in all sorts of makefiles, to
> avoid rebuilding things that are actually up to date.

Sure, got it. I think I am even taking advantage of this in other
places.

Thanks again, Paul!

Sébastien.



reply via email to

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