[Top][All Lists]

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

Re: how to allow multiple empty commands?

From: Philip Guenther
Subject: Re: how to allow multiple empty commands?
Date: Thu, 4 Feb 2010 17:50:15 -0800

On Thu, Feb 4, 2010 at 4:44 PM, Mark Galeck (CW) <address@hidden> wrote:
>>What makes you think that make will examine a header file, do the
> implicit rule search for it and decide there's no match, and then
> later in the same run do the search again?  Have you examined "make
> -d" output to see whether that's the case?
> Yes indeed with the -d option, I can see that make is remaking foobar 
> multiple times, in case like
> foobar::;
> foobar::;

Hmm, that's not the case I understood you to be concerned with.  You wrote:

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

I.e., something like:
OBJS = foo.o bar.o # etc
foo: $(OBJS)

foo.o: foo.c foo.h
bar.o: bar.c foo.h
# ...etc


and the concern is that make will try to rebuild 'foo.h' multiple
times.  When I run "make -d" against that, I see that make does the
implicit rule lookup for 'foo.h' exactly once, no matter how many
objects depend on it.  On the second and succeeding objects it just
says  "Pruning file `foo.h'."

Of course, if this is some grotty recursive make setup then that
existing optimization won't apply.  In that case, the single best
optimization you can make, in my opinion and direct experience, is
stop using recursive make and switch to a single make process (but
still multiple files of course) that does everything.

> GNU make manual indicates that there are "multiple ways" to avoid any implicit
> rule search for a target, but I only see one, to have an empty command for 
> that
> target.  What are the others, and are there any that I can use multiple times 
> on
> the same target, without make complaining.

Hmm, can you point us at where the manual says that?  I didn't see a
statement like that in a quick scan, but I've been known to see right
through entire paragraphs...

Philip Guenther

reply via email to

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