aboutsummaryrefslogtreecommitdiff
path: root/build/cli/rule.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/cli/rule.cxx')
-rw-r--r--build/cli/rule.cxx106
1 files changed, 44 insertions, 62 deletions
diff --git a/build/cli/rule.cxx b/build/cli/rule.cxx
index 6377b29..3bcd074 100644
--- a/build/cli/rule.cxx
+++ b/build/cli/rule.cxx
@@ -210,78 +210,65 @@ namespace build
// Execute our prerequsites and check if we are out of date.
//
- cli* s (execute_prerequisites<cli> (a, t, t.h ()->mtime ()));
-
- target_state ts;
+ cli* s (execute_prerequisites<cli> (a, t, t.mtime ()));
if (s == nullptr)
- ts = target_state::unchanged;
- else
- {
- // Translate source path to relative (to working directory). This
- // results in easier to read diagnostics.
- //
- path relo (relative (t.dir));
- path rels (relative (s->path ()));
+ return target_state::unchanged;
- scope& rs (t.root_scope ());
- const string& cli (rs["config.cli"].as<const string&> ());
-
- vector<const char*> args {cli.c_str ()};
+ // Translate source path to relative (to working directory). This
+ // results in easier to read diagnostics.
+ //
+ path relo (relative (t.dir));
+ path rels (relative (s->path ()));
- // See if we need to pass any --?xx-suffix options.
- //
- append_extension (args, *t.h (), "--hxx-suffix", "hxx");
- append_extension (args, *t.c (), "--cxx-suffix", "cxx");
- if (t.i () != nullptr)
- append_extension (args, *t.i (), "--ixx-suffix", "ixx");
+ scope& rs (t.root_scope ());
+ const string& cli (rs["config.cli"].as<const string&> ());
- append_options (args, t, "cli.options");
+ vector<const char*> args {cli.c_str ()};
- if (!relo.empty ())
- {
- args.push_back ("-o");
- args.push_back (relo.string ().c_str ());
- }
+ // See if we need to pass any --?xx-suffix options.
+ //
+ append_extension (args, *t.h (), "--hxx-suffix", "hxx");
+ append_extension (args, *t.c (), "--cxx-suffix", "cxx");
+ if (t.i () != nullptr)
+ append_extension (args, *t.i (), "--ixx-suffix", "ixx");
- args.push_back (rels.string ().c_str ());
- args.push_back (nullptr);
+ append_options (args, t, "cli.options");
- if (verb)
- print_process (args);
- else
- text << "cli " << *s;
+ if (!relo.empty ())
+ {
+ args.push_back ("-o");
+ args.push_back (relo.string ().c_str ());
+ }
- try
- {
- process pr (args.data ());
+ args.push_back (rels.string ().c_str ());
+ args.push_back (nullptr);
- if (!pr.wait ())
- throw failed ();
+ if (verb)
+ print_process (args);
+ else
+ text << "cli " << *s;
- timestamp s (system_clock::now ());
+ try
+ {
+ process pr (args.data ());
- // Update member timestamps.
- //
- t.h ()->mtime (s);
- t.c ()->mtime (s);
- if (t.i () != nullptr)
- t.i ()->mtime (s);
+ if (!pr.wait ())
+ throw failed ();
- ts = target_state::changed;
- }
- catch (const process_error& e)
- {
- error << "unable to execute " << args[0] << ": " << e.what ();
+ t.mtime (system_clock::now ());
+ }
+ catch (const process_error& e)
+ {
+ error << "unable to execute " << args[0] << ": " << e.what ();
- if (e.child ())
- exit (1);
+ if (e.child ())
+ exit (1);
- throw failed ();
- }
+ throw failed ();
}
- return ts;
+ return target_state::changed;
}
target_state compile::
@@ -297,16 +284,11 @@ namespace build
bool r (false);
if (t.i () != nullptr)
- {
r = rmfile (t.i ()->path (), *t.i ()) || r;
- t.i ()->mtime (timestamp_nonexistent);
- }
-
r = rmfile (t.c ()->path (), *t.c ()) || r;
- t.c ()->mtime (timestamp_nonexistent);
-
r = rmfile (t.h ()->path (), *t.h ()) || r;
- t.h ()->mtime (timestamp_nonexistent);
+
+ t.mtime (timestamp_nonexistent);
// Clean prerequisites.
//