Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GNU make --jobs option in QMAKE

I am using qmake to generate MinGW32 Makefiles for a small Qt C++ app we are developing. My problem: all those dual/quad core CPUs are sitting there idly while only one thread is doing the building. In order to parallelize things I tried passing --jobs 4 to make, but the problem is that qmake generates a generic makefile inside of which make gets called again with -f .

Is it possible to force qmake to add options to make when generating the makefile? Or maybe there's another way of setting the option outside of qmake altogether? I can't edit that specific Makefile since it's autogenerated each build.

like image 949
Saulius Žemaitaitis Avatar asked Aug 07 '09 21:08

Saulius Žemaitaitis


2 Answers

Abusing $MAKE to pass options does not work in all cases. Oftentimes, (e.g. in the configure script of Qt on Unix), it's enclosed in double quotes ("$MAKE") to allow the command to contain spaces. I know because I used the same trick before it stopped working. Qt Support then suggested (rightfully) to use $MAKEFLAGS as in

set MAKEFLAGS=-j4
make
like image 64
Marc Mutz - mmutz Avatar answered Sep 22 '22 14:09

Marc Mutz - mmutz


This works for me:

set MAKE_COMMAND=mingw32-make -j%NUMBER_OF_PROCESSORS%

like image 41
GED Avatar answered Sep 20 '22 14:09

GED