[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: submake messages not perfect
From: |
Paul D. Smith |
Subject: |
Re: submake messages not perfect |
Date: |
Tue, 31 Aug 2004 00:13:08 -0400 |
%% Dan Jacobson <address@hidden> writes:
Paul> I guess I still don't understand Dan's comment, though.
dj> Well for me, make calling several make&'s all in the same
dj> directory,
I wrote a long reply to this. Then I rewrote it. Then I decided to
delete most of it :). I've left some comments about using -j with make
below.
I'll just say that I think that the issues you've raised here apply
specifically to the extremely unusual use-case where you invoke multiple
make's from the command line in parallel, putting them into the
background. This is not a situation I've ever known anyone else to feel
is useful with make.
I don't see any real utility in the changes you've described to the
manual or the code for the traditional, 99.99% of use cases where one
invocation of make is invoked, either serially or in parallel. That
being the case I have a hard time justifying to myself the added
complexity in the documentation or in the codebase.
I will point out one important fact: recall that GNU make runs on many
platforms _OTHER_ than UNIX: it runs on DOS, Windows, Amiga, and VMS,
plus a port to OS/2 for the next release. I'd prefer to avoid
describing complex capabilities that are unique, and/or whose syntax is
unique, to UNIX or even specific shells, in the GNU make manual; that's
not where such things belong.
A few comments on parallel builds:
Paul> But, I do think it's not very useful since it's much simpler to
Paul> just let make do the parallelism for you from a single
Paul> invocation.
dj> I wanted to but found I cannot limit -j's reach to only one level.
Yes you can. Just set the commandline of any submakes to add -j1 and
force them to run serially:
.PHONY: subdir
subdir:
$(MAKE) -j 1 -C $@
dj> Do add an examples showing when
dj> $ make -j x y
dj> and
dj> $ make x& make y& wait
dj> are equivalent, and when they are not.
Paul> IMO that is not at all an appropriate example for the GNU make
Paul> manual.
Note my comments above about make running on multiple platforms, etc.
dj> Well, OK, whatever. All I know is that they can be the same or not,
dj> depending on how deep their dependencies are.
That's not what I said. I said it was safe as long as the two targets
were entirely disjoint. It doesn't matter how deep or shallow their
dependencies are, it only matters if the "sub-tree" of their dependency
graphs overlap or not.
The only thing that's different about these two invocations is the quite
obvious: since they're running completely separately, they don't know
anything about each other. That means that if their dependency graphs
overlap, you might get into a situation where both instances of make
were trying to build the same target at the same time. That is almost
guaranteed to be a problem.
If you have one instance of make running with -j, it knows which targets
have been built, which are in the process of being built, and which have
not been built yet. So, it will never build a target until all its
prerequisites have been completed.
dj> I was not able to use -j in http://jidanni.org/comp/apt-offline/ so
dj> did the two &'s.
Lots of very helpful people read this list. If you would like some
assistance, try asking a question with a small example of what you're
trying to do.
--
-------------------------------------------------------------------------------
Paul D. Smith <address@hidden> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist