[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #40431] .SHELLFLAGS is passed to shell as single argument.
From: |
Paul D. Smith |
Subject: |
[bug #40431] .SHELLFLAGS is passed to shell as single argument. |
Date: |
Sun, 03 Nov 2013 20:40:05 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.114 Safari/537.36 |
Update of bug #40431 (project make):
Status: None => Duplicate
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #3:
First, having -e enabled by default for recipes is a requirement of the latest
POSIX spec. GNU make by default adheres to the previous POSIX spec in this
respect, where -e was required to NOT be present. I'm not willing to break
backward-compatibility in this way, even if POSIX doesn't care. If you use
the .POSIX: pseudo-target to request POSIX-compatibility mode, then -e will be
enabled by default and you don't need to change .SHELLFLAGS.
Second, the behavior of .SHELLFLAGS with multiple options is correct in the
currently released version of GNU make (4.0):
$ cat Makefile
.SHELLFLAGS = -e -c
.ONESHELL :
all :
false
echo "OK"
$ make
false
echo "OK"
Makefile:4: recipe for target 'all' failed
make: *** [all] Error 1
Third, make's standard shell is /bin/sh, not bash. The POSIX shell does not
support flags such as -o pipefail and when bash is invoked as /bin/sh, it does
not either:
$ /bin/sh -e -o pipefail -c "echo hi"
/bin/sh: 0: Illegal option -o pipefail
So, if you want to use bash features in your makefiles then you must
specifically request bash as the shell:
$ cat Makefile
SHELL = /bin/bash
.SHELLFLAGS = -o pipefail -e -c
.ONESHELL :
all :
false | true
echo "OK"
$ make
false | true
echo "OK"
Makefile:5: recipe for target 'all' failed
make: *** [all] Error 1
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40431>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/