aboutsummaryrefslogtreecommitdiff
path: root/build/bin/target.cxx
blob: cb7959ce0267faa19e97238df54647128f32901f (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// file      : build/bin/target.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

#include <build/bin/target>

using namespace std;

namespace build
{
  namespace bin
  {
    static target*
    obja_factory (dir_path d, std::string n, const std::string* e)
    {
      obj* o (targets.find<obj> (d, n));
      obja* a (new obja (std::move (d), std::move (n), e));

      if ((a->group = o))
        o->a = a;

      return a;
    }

    const target_type obja::static_type
    {
      typeid (obja),
      "obja",
      &file::static_type,
      &obja_factory,
      file::static_type.search
    };

    static target*
    objso_factory (dir_path d, std::string n, const std::string* e)
    {
      obj* o (targets.find<obj> (d, n));
      objso* so (new objso (std::move (d), std::move (n), e));

      if ((so->group = o))
        o->so = so;

      return so;
    }

    const target_type objso::static_type
    {
      typeid (objso),
      "objso",
      &file::static_type,
      &objso_factory,
      file::static_type.search
    };

    static target*
    obj_factory (dir_path d, string n, const string* e)
    {
      obja* a (targets.find<obja> (d, n));
      objso* so (targets.find<objso> (d, n));
      obj* o (new obj (move (d), move (n), e));

      if ((o->a = a))
        a->group = o;

      if ((o->so = so))
        so->group = o;

      return o;
    }

    const target_type obj::static_type
    {
      typeid (obj),
      "obj",
      &target::static_type,
      &obj_factory,
      target::static_type.search
    };

    const target_type exe::static_type
    {
      typeid (exe),
      "exe",
      &file::static_type,
      &target_factory<exe>,
      file::static_type.search
    };

    static target*
    liba_factory (dir_path d, std::string n, const std::string* e)
    {
      lib* l (targets.find<lib> (d, n));
      liba* a (new liba (std::move (d), std::move (n), e));

      if ((a->group = l))
        l->a = a;

      return a;
    }

    const target_type liba::static_type
    {
      typeid (liba),
      "liba",
      &file::static_type,
      &liba_factory,
      file::static_type.search
    };

    static target*
    libso_factory (dir_path d, std::string n, const std::string* e)
    {
      lib* l (targets.find<lib> (d, n));
      libso* so (new libso (std::move (d), std::move (n), e));

      if ((so->group = l))
        l->so = so;

      return so;
    }

    const target_type libso::static_type
    {
      typeid (libso),
      "libso",
      &file::static_type,
      &libso_factory,
      file::static_type.search
    };

    static target*
    lib_factory (dir_path d, string n, const string* e)
    {
      liba* a (targets.find<liba> (d, n));
      libso* so (targets.find<libso> (d, n));
      lib* l (new lib (move (d), move (n), e));

      if ((l->a = a))
        a->group = l;

      if ((l->so = so))
        so->group = l;

      return l;
    }

    const target_type lib::static_type
    {
      typeid (lib),
      "lib",
      &target::static_type,
      &lib_factory,
      target::static_type.search
    };
  }
}