[Top][All Lists]

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

Re: Install failures are ignored

From: Alexandre Duret-Lutz
Subject: Re: Install failures are ignored
Date: 30 Aug 2002 22:28:32 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>> "Pavel" == Pavel Roskin <address@hidden> writes:


 Pavel> I don't understand the reference to "set -e".


 Pavel> Sorry, I don't know if I was supposed to try it on BSD.

FWIW, BSD make runs commands using `/bin/sh -ec' (unless the `-'
modifier is used, of course).

Anyway, that doesn't change anything for us.  Portable Makefiles
should assume `-e' is not used.

BTW, another interesting point is that BSD make has two ways of
executing commands:

 - By default it uses the "compatibility" mode:
   each command line is run in a separate shell.  
 - In another mode (enabled when you use `-j max_jobs') 
   it will run all commands at once in a single shell, 
   using `/bin/sh -evc' so the shell echoes commands 
   as it processes them.

Here is what POSIX says about this second point:

     The default in some advanced versions of make is to group all the
     command lines for a target and execute them using a single shell
     invocation; the System V method is to pass each line individually to a
     separate shell. The single-shell method has the advantages in
     performance and the lack of a requirement for many continued lines.
     However, converting to this newer method has caused portability problems
     with many historical makefiles, so the behavior with the POSIX makefile
     is specified to be the same as that of System V. It is suggested that
     the special target .ONESHELL be used as an implementation extension to
     achieve the single-shell grouping for a target or group of targets.


 Pavel> By the way, what if the user runs "make -k"?  An "exit"
 Pavel> would terminate the loop, even though the user wants
 Pavel> make to do as much as possible.  This would be
 Pavel> especially bad if the loop is for subdirectories - a
 Pavel> failure in the first of them would cause all other
 Pavel> subdirectories to be skipped, and only local commands
 Pavel> outside the loop would be executed.

(Automake already "disables" `-k' for recursive rules, see

 Pavel> You can consider this as a low-priority feature request for Automake.  
 Pavel> Perhaps it can be done by examining $(MAKE) for GNU make.

What about adding something like the following on top of each
"for/do/done" rule?

set fnord $$MAKEFLAGS; amf=$$2; \
case "$$amf" in *=*) set -e ;; *k*) ;; *) set -e ;; esac; \

The idea is to force `set -e' unless `make -k' is used.
This would free us from all these `|| exit 1'.
Alexandre Duret-Lutz

reply via email to

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