aboutsummaryrefslogtreecommitdiff
path: root/build/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-12-03 14:02:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-12-03 14:02:56 +0200
commit3b56319cb635c71768106c01b04c5fd719b93242 (patch)
treec79ffb6791661d8859855fdaecbdbb2a4674a192 /build/target
parenta693507feb11950899b3fcfcd9ee230fd7baa61f (diff)
Initial build tool sketch (simulation)
To build: g++-4.9 -std=c++11 -g -I.. -o bd bd.cxx
Diffstat (limited to 'build/target')
-rw-r--r--build/target69
1 files changed, 69 insertions, 0 deletions
diff --git a/build/target b/build/target
new file mode 100644
index 0000000..e6f05a5
--- /dev/null
+++ b/build/target
@@ -0,0 +1,69 @@
+// file : build/target -*- C++ -*-
+// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
+// license : MIT; see accompanying LICENSE file
+
+#include <string>
+#include <vector>
+#include <functional>
+
+namespace build
+{
+ class target;
+ typedef std::vector<std::reference_wrapper<target>> targets;
+
+ class target
+ {
+ public:
+ target (std::string n): name_ (n) {}
+
+ const std::string&
+ name () const {return name_;}
+
+ const targets&
+ prerequisites () const {return prerequisites_;}
+
+ targets&
+ prerequisites () {return prerequisites_;}
+
+ void
+ prerequisite (target& t) {prerequisites_.push_back (t);}
+
+ public:
+ typedef bool (*rule_type) (target&, const targets&);
+
+ rule_type
+ rule () const {return rule_;}
+
+ void
+ rule (rule_type r) {rule_ = r;}
+
+ private:
+ target (const target&) = delete;
+ target& operator= (const target&) = delete;
+
+ private:
+ std::string name_;
+ targets prerequisites_;
+ rule_type rule_ {0};
+ };
+
+ class exe: public target
+ {
+ using target::target;
+ };
+
+ class obj: public target
+ {
+ using target::target;
+ };
+
+ class hxx: public target
+ {
+ using target::target;
+ };
+
+ class cxx: public target
+ {
+ using target::target;
+ };
+}