[sr-dev] Small problems with make modules.. and a fix

marius zbihlei marius.zbihlei at 1and1.ro
Wed Feb 3 10:49:23 CET 2010


Hello,

I want to make s/k modules with -j 3 . Thus specifying 3 parallel jobs 
(Hehe I have one of those fancy SMP machines). The problem is this:

 >make -j 3
....
make[1]: Entering directory `/home/marius/dev/sip-router/modules/avpops'
make[1]: warning: jobserver unavailable: using -j1.  Add `+' to parent 
make rule.
....

Problem description is here 
http://lists.samba.org/archive/distcc/2004q1/002160.html(I also checked 
the gnu make manual and this mail is a rather complete copy-paste of the 
section in question)

A description of the jobserver implementation in here 
http://make.paulandlesley.org/jobserver.html.

The code in the Makefile which causes this is :

.PHONY: $(1)
$(1): modules.lst
    @for r in $($(1)) "" ; do \
        if [ -n "$$$$r" -a -r "$$$$r/Makefile" ]; then \
            $(call oecho, "" ;) \
            $(call oecho, "" ;) \
            if  $(MAKE) -C $$$$r $$(mk_params) || [ ${err_fail} != 1 ] ; 
then \
                :; \
            else \
                exit 1; \
            fi ; \
        fi ; \
    done; true

Because I thought the problem might be with the for construct(make 
launches a new shell) I have replaced this with

.PHONY: $(1)
$(1): modules.lst
    @$(foreach r,$($(1)),$(call module_make,$(r),$(mk_params)))

And in Makefile.rules I've added

module_make=    if [ -n "$(1)" -a -r "$(1)/Makefile" ]; then \
            $(call oecho, "" ;) \
            $(call oecho, "" ;) \
            ( $$(MAKE) -C $(1) $(2) || [ ${err_fail} != 1 ] )  || exit 1; \
        fi ; \

This fixed the warning and multiple make jobs work fine now with make 
modules.

So. Do I push?!

Marius





More information about the sr-dev mailing list