blob: 4319ccb405f7b9e3c915c98ddc972710a534c89a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
// file : build/target -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#ifndef BUILD_TARGET
#define BUILD_TARGET
#include <string>
#include <vector>
#include <functional> // std::reference_wrapper
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&);
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;
};
}
#endif // BUILD_TARGET
|