Reputation: 1847
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.
Upvotes: 8
Views: 3181
Reputation: 4399
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.
Upvotes: 4
Reputation: 100856
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.
Upvotes: 3