[CMake] Parallel jobs failed for cmake

Paul Smith paul at mad-scientist.net
Mon Dec 14 08:32:32 EST 2015


On Mon, 2015-12-14 at 09:34 +0300, Igor Sobinov wrote:
> So, If I write in makefile
> 
> 
> build_release: $(RELEASE_DIR)
>     @cd $(RELEASE_DIR); $(MAKE) release
> 
> I got an error
> 
> Also if I write
> build_release: $(RELEASE_DIR)
>     $(MAKE) release -C  $(RELEASE_DIR)
> 
> I got an error too
> 
> But this is successfull command:
> # cd $RELEASE_DIR; make release -j10
> 
> Why make doesn't support jobs for subdirs?

All three of these work for me, so it must be something else in your
makefile that you haven't shown us that's causing the problem.  Can you
provide a SSCCE (http://sscce.org/)?

As Bill points out this is a make issue, NOT a cmake issue.  I recommend
you re-start this thread with all details (operating system, version of
make, SSCCE, etc.) on the help-make at gnu.org mailing list rather than
here.

I'll offer one possible suggestion, first: you haven't by any chance
changed the SHELL variable in your external makefile to use csh, have
you?

    SHELL = /bin/csh

(or tcsh either).  Because if you have, that's the problem.  Csh is a
terrible shell for many reasons but in particular it cannot be used as
the shell for makefiles, if you want the jobserver feature to work.

> core::
>         +(cd core; make)
> 
> With this, GNU Make is able to distribute the jobs between the
> subdirectories. (I have a number of such targets in my main Makefile.)

Bill's comment, that you should use $(MAKE) and never plain "make", is
correct.  It's better to use $(MAKE) for many reasons, only some of
which are handled by prefixing the recipe with "+".


More information about the CMake mailing list