help-make
[Top][All Lists]
Advanced

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

parallel and recursive make


From: Ethan Tira-Thompson
Subject: parallel and recursive make
Date: Wed, 25 Mar 2009 16:41:53 -0400

I have what seems a relatively simple issue, but I can't figure out the solution.

I have a project, with a module built via recursive make.
This module has some header files which are constructed from a sort of template file (call it a 'fsm' file to avoid confusion with C++ templates or such)
Source files in the project then include the generated header files from the module.

The problem is that when using parallel builds, if a 'fsm' file is modified, the module headers are regenerated, but the project source files are only recompiled on the *next* make.  If I use a single-threaded build, then everything is kept in sync properly.

How can I fix this?  I've attached a very small sample of the issue.  Fails on make 3.81, on Fedora and OS X.

Thanks,
  -Ethan

Correct build (single process):
580 ~/maketest$ touch sub/bar.h.fsm && make
Processing makefile
make -C "sub"
cp "bar.h.fsm" "bar.h" && touch "bar.h"
echo "foo.d foo.o: sub/bar.h" > "foo.d"
Processing makefile
make -C "sub"
make[1]: Nothing to be done for `all'.
g++ "foo.cc" -o "foo.o" -c 
g++ "foo.o" -o "foo" -L/opt/local/lib

Bad build when parallel:
581 ~/maketest$ touch sub/bar.h.fsm && make -j2
Processing makefile
make -C "sub"
cp "bar.h.fsm" "bar.h" && touch "bar.h"
make: Nothing to be done for `all'.

Catches it the next time though:
582 ~/maketest$ make -j2
Processing makefile
make -C "sub"
make[1]: Nothing to be done for `all'.
echo "foo.d foo.o: sub/bar.h" > "foo.d"
Processing makefile
make -C "sub"
make[1]: Nothing to be done for `all'.
g++ "foo.cc" -o "foo.o" -c 
g++ "foo.o" -o "foo" -L/opt/local/lib

Attachment: maketest.zip
Description: Zip archive


reply via email to

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