help-make
[Top][All Lists]
Advanced

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

Re: Parallelizing recursive calls to make


From: Paul D. Smith
Subject: Re: Parallelizing recursive calls to make
Date: Wed, 2 Mar 2005 17:56:33 -0500

%% Henrik Grimm <address@hidden> writes:

  hg> I have the following rule in my makefile:
  hg> libraries: $(LIBRARIES)
  hg>   $(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir) libraries;)

  hg> The idea is that when i specify "libraries" as target all libraries in 
  hg> the local directory are built, and make is called recursively in all 
  hg> subdirectories to build all libraries.

  hg> Now, my problem is that I want this to be done in parallel, i.e. it 
  hg> should be able to build multiple libraries in different directories 
  hg> concurrenlty. I have tried to change the ";" character into a "&", but 
  hg> it doesn't seem to work correctly (and doesn't respect the "-j" option).

Then you can't put it into a single shell invocation: make cannot split
up your rule into multiple parts and run them in parallel.  It can only
build different targets in parallel.

This is a bad way to handle make recursion, and this is one (but not
the only) reason.


If you look in the GNU make manual there's an example of how to do this
more correctly in the section on Phony Targets.

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




reply via email to

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