[Top][All Lists]

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

RE: how to allow multiple empty commands?

From: Paul Smith
Subject: RE: how to allow multiple empty commands?
Date: Fri, 05 Feb 2010 00:55:59 -0500

On Thu, 2010-02-04 at 20:37 -0800, Mark Galeck (CW) wrote:
> Right, it your case indeed it says "pruning", but in my case, which is
> just multiple empty commands, make either complains (with :;) , or
> goes right to work (with ::;), which is neither of them I would
> want.  

Philip is trying to go back to the REAL problem you have and solve that,
rather than trying to work out a way to implement a solution to an issue
that came up as a 3rd or 4th generation away from the real problem.

Of course if you create multiple double-colon rules they will all be
run: that's the ENTIRE POINT of using double-colon rules: the same
target is linked to multiple command lists, and all of them are invoked.

Philip is saying, why do you even want to bother to create all these
empty rules?  If you didn't create them you wouldn't have to use
single-colon rules (and live with the warnings) or double-colon rules
(and live with lots of extra effort trying to build targets).  You
wouldn't have them at all.

Your statement for this, which raised red flags for both Philip and I,

> One of the things that take time, I think, is make trying to "build"
> all those source and header files, every time it encounters a header
> file prerequisite (automatically generated) for an object file, and
> for each object file typically there are thousands, each time, it
> tries to find implicit rules for that header file.

The first thing that's bad here is the "I think".  If you don't KNOW
that it causes a performance problem, then why are you even bothering to
fix it?  "Premature optimization" is where a designer will try to guess
what parts of the code will be slow, without any actual investigation,
and jump through lots of hoops to speed that code up.  Then you measure
and you realize that your environment is spending all its time in a
completely different place that you never guessed.

Do not guess.  Measure.  Do not try to conjure up a complex and
confusing solution to a problem you might not actually have.

As Philip points out, in the absence of double-colon rules make will
consider how to build each target (remember that each prerequisite is
also considered a target) exactly one time per instance of make.  So,
even if you have a massively complex makefile with hundreds of targets
and thousands of prerequisites, with lots of duplication of headers,
etc., make will still only try to build each prerequisite one time.

The best way to keep unnecessary implicit rules searches is to remove
the implicit rules you don't need, make sure that you are choosing
appropriate terminal/non-terminal entries for match-anything rules, and
maybe create some dummy pattern rules.

Also, you can move away from implicit rules and go to static pattern
rules, esp. if your makefiles use variables for prerequisite lists, etc.

 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]