aboutsummaryrefslogtreecommitdiff
path: root/build/target
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-01-16 14:11:14 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-01-16 14:11:14 +0200
commitc106259517d7693ea8e24564bc890fe575d5edcd (patch)
treebbf87f83edeaf60ff3dfa6fff33c6b7504f5318b /build/target
parentdf50091259a34fa4718f38c0e3b7b64f6e2469ac (diff)
Implement rule chaining for cxx::link
Diffstat (limited to 'build/target')
-rw-r--r--build/target21
1 files changed, 18 insertions, 3 deletions
diff --git a/build/target b/build/target
index 508aedb..f57e8cc 100644
--- a/build/target
+++ b/build/target
@@ -12,7 +12,7 @@
#include <memory> // unique_ptr
#include <functional> // function, reference_wrapper
#include <typeindex>
-#include <iosfwd>
+#include <ostream>
#include <cassert>
#include <utility> // move
@@ -36,6 +36,12 @@ namespace build
target* (*const factory) (path, std::string, const std::string*);
};
+ inline std::ostream&
+ operator<< (std::ostream& os, const target_type& tt)
+ {
+ return os << tt.name;
+ }
+
class target
{
public:
@@ -104,7 +110,16 @@ namespace build
x.ext != nullptr && y.ext != nullptr && x.ext < y.ext);
}
- typedef std::set<std::unique_ptr<target>, compare_pointer_target> target_set;
+ struct target_set: std::set<std::unique_ptr<target>, compare_pointer_target>
+ {
+ std::pair<target&, bool>
+ insert (const target_type&,
+ path dir,
+ std::string name,
+ const std::string* ext,
+ tracer&);
+ };
+
extern target_set targets;
extern target* default_target;
@@ -170,7 +185,7 @@ namespace build
path () const {return path_;}
void
- path (path_type p) {assert (path_.empty ()); path_ = p;}
+ path (path_type p) {assert (path_.empty ()); path_ = std::move (p);}
protected:
virtual timestamp