Make: disable parallel build in a subdirectory for only one purpose

I have a fairly large project with autotools support that lives in a directory tree consisting of many directories with subdirectories. He got a check target (in each subdirectory, as well as in the main directory), which performs many automated tests. The check target is constructed recursively.

Building, as well as parallel testing (using the -j make option) works for most directories. However, there is one directory that contains a test that does not work in parallel execution (time sensitivity), but is transmitted during a serial run.

The question arises: is there a way to force make to build the check series in series only in this subdirectory while building everything else?

+6
source share
2 answers

If you understand correctly, then when you run the recursive make that creates the check target, you can simply pass -j1 specifically to ensure that it runs in serial:

 check: ; $(MAKE) -j1 ... 
+1
source

Add to your Makefile :

.NOTPARALLEL:

See the GNU make documentation here .

+6
source

Source: https://habr.com/ru/post/947562/


All Articles