QMAKE中的GNU make --jobs选项 [英] GNU make --jobs option in QMAKE
问题描述
我正在使用qmake为我们正在开发的小型Qt C ++应用程序生成MinGW32 Makefile.我的问题是:所有那些双/四核CPU都闲置在那里,而只有一个线程正在构建.为了使事物并行化,我尝试传递--jobs 4进行制作,但是问题是qmake生成了一个通用的makefile,在其中,make可以通过-f再次调用.
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 .
是否可以强制qmake在生成Makefile时添加要制作的选项?或者,也许还有另一种完全在qmake之外设置选项的方法?我无法编辑该特定的Makefile,因为它是每个构建文件自动生成的.
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.
推荐答案
滥用$MAKE
传递选项并非在所有情况下均有效.通常(例如,在Unix上Qt的配置脚本中),它用双引号("$MAKE"
)括起来,以允许命令包含空格.我知道,因为在停止工作之前我使用了相同的技巧.然后,Qt支持人员(正确地)建议使用$MAKEFLAGS
作为
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
这篇关于QMAKE中的GNU make --jobs选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!