help-make
[Top][All Lists]
Advanced

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

Re: Merging rules


From: Paul Smith
Subject: Re: Merging rules
Date: Thu, 14 Jun 2018 08:19:54 -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.

> 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.

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



reply via email to

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