diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-03 14:02:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2014-12-03 14:02:56 +0200 |
commit | 3b56319cb635c71768106c01b04c5fd719b93242 (patch) | |
tree | c79ffb6791661d8859855fdaecbdbb2a4674a192 /build/bd.cxx | |
parent | a693507feb11950899b3fcfcd9ee230fd7baa61f (diff) |
Initial build tool sketch (simulation)
To build:
g++-4.9 -std=c++11 -g -I.. -o bd bd.cxx
Diffstat (limited to 'build/bd.cxx')
-rw-r--r-- | build/bd.cxx | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/build/bd.cxx b/build/bd.cxx new file mode 100644 index 0000000..918434a --- /dev/null +++ b/build/bd.cxx @@ -0,0 +1,63 @@ +// file : build/bd.cxx +// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC +// license : MIT; see accompanying LICENSE file + +#include <vector> +#include <iostream> + +#include <build/target> + +using namespace std; + +namespace build +{ + bool + update (target& t) + { + const targets& ps (t.prerequisites ()); + + for (target& p: ps) + if (!update (p)) + return false; + + //@@ TODO: check for existance, compare timestamps. + + auto r (t.rule ()); + return r != 0 ? r (t, t.prerequisites ()) : true; + } +} + +using namespace build; + +bool +cxx_compile_rule (target& t, const targets& p) +{ + //@@ TODO: actually execute + + cerr << "c++ " << t.name () << endl; + return true; +} + +bool +cxx_link_rule (target& t, const targets& p) +{ + cerr << "ld " << t.name () << endl; + return true; +} + +int +main (int argc, char* argv[]) +{ + exe bd ("bd"); + obj bd_o ("bd.o"); + bd.prerequisite (bd_o); + bd.rule (&cxx_link_rule); + + cxx bd_cxx ("bd.cxx"); + hxx target ("target"); + bd_o.prerequisite (bd_cxx); + bd_o.prerequisite (target); + bd_o.rule (&cxx_compile_rule); + + update (bd); +} |