help-make
[Top][All Lists]
Advanced

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

Re: how to instruct gmake to read included fragmented makefilesparalally


From: Philip Guenther
Subject: Re: how to instruct gmake to read included fragmented makefilesparalally..
Date: Thu, 21 Jun 2007 19:29:57 -0600

On 6/21/07, Divakar Venkata (divvenka) <address@hidden> wrote:
...
o. We use -MD -MF flags of compiler to create makedependencies
for each object file and include them too before compilation..
And these files are ~40kb

Generating dependencies *before compiling* using makedepend or gcc's
-MF option or such is often pointless.  You need dependencies for two
reasons:
1) so that make can determine whether the file is older than one or more of
   its dependencies, and
2) so that make can build or update any generated dependencies before
   building the target.

If a target doesn't exist, then (1) is pointless: a missing file is
out-of-date by definition.  If you calculate and save the dependencies
when compiling the file, then (1) is taken care of on the fly without
I/O wasting makedepend processing.  That can be done using gcc -MD
option in tandem with the -c option.

So, can case (2), generated source files, be handled more efficiently
than the blunt hammer of makedepend?  Many projects don't have *any*
and can ignore it.  Others have only a few (say, a yacc parser) and
can just declare them manually.  If you have many, then finding a way
to calculate the maximum possible direct dependencies and create
order-only dependencies for them can do the trick without wasting I/O.
The largest project I deal with has an variable in each directory's
make fragment that control which other modules this one may 'use'
which is used to add the correct -I options and generate order-only
dependencies on any generated files in those other modules.


o. I have seen it takes anywhere between 5 to 10mins..(depending on
system load).

I mean time spent in calculating dependencies.

If by "calculating dependencies" you mean "running makedepend", then
stop doing that.  If you're using makedepend, you should only need to
run it
1) after a fresh checkout
2) after a "make realclean" or other "nuke everything" cleanup...and you should
   almost never be doing *that*.

Remember, there are only three reasons to run 'make clean':
1) to save diskspace,
2) to work around broken make files, and
3) paranoia (usually in the run up to a release)

If you're running 'make clean' and 'make depend' often, then you
should treat the cause:
1) get more diskspace
2) fix the broken makefiles, or
3) take you anxiety medication and/or make your boss take his or hers.


If that *isn't* what you meant by "calculating dependencies", then
please describe *exactly* what you're measuring and how you measured
it.


Or time taken before starting compilation..

So, how long does the "nothing" target suggested by David Boyce in the
message you quoted take?


Philip Guenther




reply via email to

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