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

File: autoconf.info,  Node: Failure in Make Rules,  Next: Special Chars in Names,  Prev: $< in Ordinary Make Rules,  Up: Portable Make

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

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, although not all
‘make’ implementations have historically 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-2025
Individual documents may contain additional copyright information.