aboutsummaryrefslogtreecommitdiff
path: root/dep.cc
diff options
context:
space:
mode:
authorStefan Becker <stefanb@gpartner-nvidia.com>2016-04-07 13:28:42 +0300
committerStefan Becker <stefanb@gpartner-nvidia.com>2016-04-12 12:31:46 +0300
commit187bf08e7fc847da6dc8482383fa5c8364f0ac50 (patch)
tree3ac5c8045bd10041c6636231a34912d932f87884 /dep.cc
parentcd060c5ce8dc4128e3bf3dcbed57e36ef93486d5 (diff)
[C++] Add support for .POSIX:
Add a global flag that is set to "true" when .POSIX: is encountered. The flag will switch the bash flags from "-c" to "-ec", i.e. enable correct error handling of shell command lines. Fixes https://github.com/google/kati/issues/48 Change-Id: Ieea386742b05b52d209b74e640e14212f0e2da88
Diffstat (limited to 'dep.cc')
-rw-r--r--dep.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/dep.cc b/dep.cc
index da209c7..0a0fc8e 100644
--- a/dep.cc
+++ b/dep.cc
@@ -25,6 +25,7 @@
#include "eval.h"
#include "fileutil.h"
+#include "flags.h"
#include "log.h"
#include "rule.h"
#include "stats.h"
@@ -261,6 +262,10 @@ class DepBuilder {
for (Symbol t : targets)
phony_.insert(t);
}
+ if (GetRuleInputs(Intern(".POSIX"), &targets, &loc)) {
+ // .POSIX: enables bash -e command line option globally
+ g_flags.posix_shell = true;
+ }
if (GetRuleInputs(Intern(".KATI_RESTAT"), &targets, &loc)) {
for (Symbol t : targets)
restat_.insert(t);
@@ -287,7 +292,6 @@ class DepBuilder {
".EXPORT_ALL_VARIABLES",
".NOTPARALLEL",
".ONESHELL",
- ".POSIX",
NULL
};
for (const char** p = kUnsupportedBuiltinTargets; *p; p++) {