diff options
-rw-r--r-- | build2/c/init.cxx | 21 | ||||
-rw-r--r-- | build2/cc/common.hxx | 5 | ||||
-rw-r--r-- | build2/cc/compile.cxx | 11 | ||||
-rw-r--r-- | build2/cc/init.cxx | 8 | ||||
-rw-r--r-- | build2/cxx/init.cxx | 1 |
5 files changed, 30 insertions, 16 deletions
diff --git a/build2/c/init.cxx b/build2/c/init.cxx index 4256e3e..a54060c 100644 --- a/build2/c/init.cxx +++ b/build2/c/init.cxx @@ -143,23 +143,24 @@ namespace build2 v.insert<strings> ("c.loptions"), v.insert<strings> ("c.libs"), - v.insert ("cc.poptions"), - v.insert ("cc.coptions"), - v.insert ("cc.loptions"), - v.insert ("cc.libs"), + v["cc.poptions"], + v["cc.coptions"], + v["cc.loptions"], + v["cc.libs"], v.insert<strings> ("c.export.poptions"), v.insert<strings> ("c.export.coptions"), v.insert<strings> ("c.export.loptions"), v.insert<vector<name>> ("c.export.libs"), - v.insert ("cc.export.poptions"), - v.insert ("cc.export.coptions"), - v.insert ("cc.export.loptions"), - v.insert ("cc.export.libs"), + v["cc.export.poptions"], + v["cc.export.coptions"], + v["cc.export.loptions"], + v["cc.export.libs"], - v.insert ("cc.type"), - v.insert ("cc.system"), + v["cc.type"], + v["cc.system"], + v["cc.reprocess"], v.insert<string> ("c.std", variable_visibility::project), 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"])) diff --git a/build2/cxx/init.cxx b/build2/cxx/init.cxx index 70360bc..395a9f8 100644 --- a/build2/cxx/init.cxx +++ b/build2/cxx/init.cxx @@ -223,6 +223,7 @@ namespace build2 v["cc.type"], v["cc.system"], + v["cc.reprocess"], v.insert<string> ("cxx.std", variable_visibility::project), |