Consider the following makefile:
.DEFAULT_GOAL := all
.PHONY: all
all: target0 target1 target2
# This line makes all targets run serially
#.NOTPARALLEL: target0
.PHONY: target0
target0:
@python delayed_print.py 0
.PHONY: target1
target1:
@python delayed_print.py 1
.PHONY: target2
target2:
@python delayed_print.py 2
delayed_print.py is just a small Python script that prints the argument after some seconds so I can easily see what runs in parallel.
By default (with -j option for mingw32-make), Make runs all the targets in parallel. If I enable the .NOTPARALLEL line, then all targets run serially. Is this a bug? Am I doing something wrong?
My intention is to run a subset of the targets in parallel and force sequential execution of some targets.
For reference:
mingw32-make --version
GNU Make 4.3
Built for Windows32
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
The ability to give specific targets to .NOTPARALLEL
was added in GNU Make 4.4, along with the .WAIT
special target.
See the NEWS file: https://git.savannah.gnu.org/cgit/make.git/tree/NEWS?h=4.4.1#n137