diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-17 15:13:58 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-05-17 15:13:58 +0200 |
commit | aaf2525e9e8ed356feba437e56df737428a52f55 (patch) | |
tree | d6f0903840a743cf3dd0e37fa4d87e12b07fe3c6 /build2/cc | |
parent | 23a1ab205c777330453a8137557cd02754533748 (diff) |
Add ability to disable use of preprocessed output in compilation
This can be done from a buildfile for a scope (including project root scope)
and per target via cc.reprocess:
cc.reprocess = true
obj{hello}: cc.reprocess = false
As as well externally via config.cc.reprocess:
b config.cc.reprocess=true [configure]
Diffstat (limited to 'build2/cc')
-rw-r--r-- | build2/cc/common.hxx | 5 | ||||
-rw-r--r-- | build2/cc/compile.cxx | 11 | ||||
-rw-r--r-- | build2/cc/init.cxx | 8 |
3 files changed, 18 insertions, 6 deletions
diff --git a/build2/cc/common.hxx b/build2/cc/common.hxx index c22140c..3abb086 100644 --- a/build2/cc/common.hxx +++ b/build2/cc/common.hxx @@ -63,8 +63,9 @@ namespace build2 const variable& c_export_loptions; const variable& c_export_libs; - const variable& c_type; // cc.type - const variable& c_system; // cc.system + const variable& c_type; // cc.type + const variable& c_system; // cc.system + const variable& c_reprocess; // cc.reprocess const variable& x_std; diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 32b5f6e..1eb4c9b 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -567,11 +567,14 @@ namespace build2 pair<auto_rmfile, bool> p (inject (act, t, lo, src, dd, u)); dd.close (); - // If the preprocessed output is suitable for compilation, pass it - // along. + // If the preprocessed output is suitable for compilation and is not + // disabled, pass it along. // - if (p.second) - md.psrc = move (p.first); + if (!p.first.path ().empty () && p.second) + { + if (!cast_false<bool> (t[c_reprocess])) + md.psrc = move (p.first); + } md.mt = u ? timestamp_nonexistent : mt; } diff --git a/build2/cc/init.cxx b/build2/cc/init.cxx index 8d20573..a5fcf83 100644 --- a/build2/cc/init.cxx +++ b/build2/cc/init.cxx @@ -78,6 +78,11 @@ namespace build2 // v.insert<bool> ("cc.system"); + // Ability to disable using preprocessed output for compilation. + // + v.insert<bool> ("config.cc.reprocess", true); + v.insert<bool> ("cc.reprocess"); + return true; } @@ -166,6 +171,9 @@ namespace build2 rs.assign ("cc.libs") += cast_null<strings> ( config::optional (rs, "config.cc.libs")); + if (lookup l = config::omitted (rs, "config.cc.reprocess").first) + rs.assign ("cc.reprocess") = *l; + // Load the bin.config module. // if (!cast_false<bool> (rs["bin.config.loaded"])) |