Is there any way to make parallel invocations of GNU make (ie. make -jN) cease ALL compilation immediately whenever it encounters an error?
Currently I see a "Waiting for unfinished jobs" message & then many lines of output whilst existing make processes finish.
-j [jobs], --jobs[=jobs] Specifies the number of jobs (commands) to run simultaneously. If there is more than one -j option, the last one is effective. If the -j option is given without an argument, make will not limit the number of jobs that can run simultaneously.
I see this is an old thread, but the answer isn't definitive. This has always worked well for me:
#!/usr/bin/make -f
MAKEPID:= $(shell echo $$PPID)
$(mytargets):
@script_that_runs_in_parallel.sh $@ || kill -TERM $(MAKEPID)
It's pretty brutal, but it does the job.
There is no way to do this (in GNU make). The only possible way would be to add a boilerplate stanza to all of your recipes such that if they failed, you would catch the failure and use killall or something similar to kill all instances of make. Tricky and dangerous for sure.
Of course you can always hit CTRL-C yourself to stop make.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With