From 3b56319cb635c71768106c01b04c5fd719b93242 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 3 Dec 2014 14:02:56 +0200 Subject: Initial build tool sketch (simulation) To build: g++-4.9 -std=c++11 -g -I.. -o bd bd.cxx --- build/target | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 build/target (limited to 'build/target') 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 +#include +#include + +namespace build +{ + class target; + typedef std::vector> 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; + }; +} -- cgit v1.1