manpagez: man pages & more
info autoconf
Home | html | info | man

File: autoconf.info,  Node: Failure in Make Rules,  Next: Command Line Prefixes,  Prev: $< in Ordinary Make Rules,  Up: Portable Make

12.2 Failure in Make Rules
==========================

Unless errors are being ignored (e.g., because a makefile command line
is preceded by a ‘-’ prefix), POSIX 2008 requires that ‘make’ must
invoke each command with the equivalent of a ‘sh -e -c’ subshell, which
causes the subshell to exit immediately if a subsidiary simple-command
fails, with some complicated exceptions.  Historically not all ‘make’
implementations followed this rule.  For example, the command ‘touch T;
rm -f U’ may attempt to remove ‘U’ even if the ‘touch’ fails, although
this is not permitted with POSIX make.  One way to work around failures
in simple commands is to reword them so that they always succeed, e.g.,
‘touch T || :; rm -f U’.  However, even this approach can run into
common bugs in BSD implementations of the ‘-e’ option of ‘sh’ and ‘set’
(*note Limitations of Shell Builtins: set.), so if you are worried about
porting to buggy BSD shells it may be simpler to migrate complicated
‘make’ actions into separate scripts.

© manpagez.com 2000-2026
Individual documents may contain additional copyright information.