make: disable parallel building in subdirectory for single target only

隐身守侯 提交于 2019-12-05 18:37:35

问题


I have a rather huge autotools-powered project that lives in a directory tree consisting of a lot of directories with subdirectories. It's got a target check (in each subdirectory as well as the main directory) that executes a whole lot of automated tests. The check target is built recursively.

Building as well as testing in parallel (via the -j option to make) works for most of the directories. There is however one directory that contains test that don't work when executed in parallel (timing sensitivity), but pass when run serially.

The question is: Is there a way to force make to build the check target serially in just this one subdirectory while building everything else in parallel?


回答1:


If I understood you correctly, then when you run the recursive make that builds the check target you can just pass -j1 specifically, to ensure that it runs serially:

check: ; $(MAKE) -j1 ...



回答2:


Add to your Makefile:

.NOTPARALLEL:

See the documentation of GNU make here.



来源:https://stackoverflow.com/questions/17172310/make-disable-parallel-building-in-subdirectory-for-single-target-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!