Hello Joakim,
* Joakim Tjernlund wrote on Wed, Jan 27, 2010 at 03:05:26PM CET:
> make -s -j6 all install
> ends up with a:
> mv: cannot stat `.deps/libeq_mib_if_a-eq_mib_equipment.Tpo': No such file or
> directory
> make[1]: *** [libeq_mib_if_a-eq_mib_equipment.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> appears to me that there is some
> dependency missing so that both targets is run in parallel.
> Is this expected behaviour or a bug?
This is a known but not well-documented bug/limitation in the makefiles
created by Automake: With parallel make, you cannot explicitly list
more than one of the recursive targets on the command line.
Note that there is a GNU make-specific way to avoid this bug, which is
used for example in the gnulib module gnumakefile, that one can
otherwise use in a toplevel build directory GNUmakefile like this:
set ALL_RECURSIVE_TARGETS to all of your own recursive targets,
include Makefile
...
# Tell version 3.79 and up of GNU make to not build goals in this
# directory in parallel, in case someone tries to build multiple
# targets, and one of them can cause a recursive target to be invoked.
# Only set this if Automake doesn't provide it.
AM_RECURSIVE_TARGETS ?= $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) \
dist distcheck tags ctags
ALL_RECURSIVE_TARGETS += $(AM_RECURSIVE_TARGETS)
ifneq ($(word 2, $(MAKECMDGOALS)), )
ifneq ($(filter $(ALL_RECURSIVE_TARGETS), $(MAKECMDGOALS)), )
.NOTPARALLEL:
endif
endif
I don't know of an easy way to portably avoid the issue that does not
incur unnecessary work, and does not totally kill concurrency in the
toplevel; e.g., if automake added a dependency
install: all
that would let `make install' walk each makefile twice, unnecessarily.
If we just put
.NOTPARALLEL:
in the toplevel Makefile, then all toplevel work would happen
serialized.
Another GNU make-specific way to avoid it could be to use order-only
prerequisites.
Cheers,
Ralf