help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to get make to terminate itself at the first error?


From: Martin d Anjou
Subject: Re: how to get make to terminate itself at the first error?
Date: Tue, 3 Feb 2009 19:38:00 -0500 (EST)
User-agent: Alpine 1.10 (LNX 962 2008-03-14)

Hi,

I have done some more characterization.

To recap, edit job.c to call fatal_error_signal(SIGTERM) as show here: http://lists.gnu.org/archive/html/help-make/2009-02/msg00002.html

The goal is to get make to terminate at the first error.

The problem is I am getting mixed success, and it seems to depend on the commands for the targets. I have chosen to use "sleep" to emulate a long compile time in the examples below.

Behavior 1 (bad)
----------------

The "sleep" command does not die.

$ cat makefile
all: t1 t2
t1:
        sleep 60 && echo done || echo failed
t2:
        sleep 2 && exit 1
$ make -j 2
sleep 60 && echo done || echo failed
sleep 2 && exit 1
make: *** [t2] Error 1
make: *** Waiting for unfinished jobs....
make: *** [t1] Terminated
Terminated
$ ps -ef | grep sleep
martin   22343     1  0 18:36 pts/5    00:00:00 sleep 60

Using process substitution takes the whole 60 seconds to return, despite that the plain command without process substitution returns to the prompt as soon as target t2 exits:

$ time t=$(make -j 2)
make: *** [t2] Error 1
make: *** Waiting for unfinished jobs....
make: *** [t1] Terminated

real    1m0.007s
...
$

Behavior 2 (good)
-----------------

The "sleep" command dies.

$ cat makefile
all: t1 t2
t1:
        sleep 60
t2:
        sleep 2 && exit 1
$ make -j 2
sleep 60
sleep 2 && exit 1
make: *** [t2] Error 1
make: *** Waiting for unfinished jobs....
make: *** [t1] Terminated
Terminated
$ ps -ef | grep sleep

In this case, process substitution returns as quickly as target t1 exits:
$ time t=$(make -j 2)
make: *** [t2] Error 1
make: *** Waiting for unfinished jobs....
make: *** [t1] Terminated

real    0m2.008s
...
$

I have tried two versions of bash (3.2.39 and 4.0-rc1), and they behave the same.

What kind of problem is this?

Have I placed the fatal_error_signal(SIGTERM) call in the right place?

Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]