]> git.tdb.fi Git - builder.git/blob - source/tool.cpp
Delay locating tool executables until the tool is needed
[builder.git] / source / tool.cpp
1 #include <algorithm>
2 #include "tool.h"
3
4 using namespace std;
5
6 Tool::Tool(Builder &b, const string &t):
7         builder(b),
8         architecture(0),
9         tag(t),
10         executable(0),
11         prepared(false)
12 { }
13
14 Tool::Tool(Builder &b, const Architecture &a, const string &t):
15         builder(b),
16         architecture(&a),
17         tag(t),
18         executable(0),
19         prepared(false)
20 { }
21
22 bool Tool::accepts_suffix(const string &suffix, bool aux) const
23 {
24         if(find(input_suffixes.begin(), input_suffixes.end(), suffix)!=input_suffixes.end())
25                 return true;
26         else if(aux)
27                 return find(aux_suffixes.begin(), aux_suffixes.end(), suffix)!=aux_suffixes.end();
28         else
29                 return false;
30 }
31
32 Target *Tool::create_target(Target &source, const string &arg)
33 {
34         list<Target *> sources;
35         sources.push_back(&source);
36         return create_target(sources, arg);
37 }
38
39 void Tool::prepare()
40 {
41         if(prepared)
42                 return;
43
44         prepared = true;
45         do_prepare();
46 }
47
48
49 SubTool::SubTool(Tool &p):
50         Tool(p),
51         parent(p)
52 { }