]> git.tdb.fi Git - builder.git/blob - source/tool.cpp
Make tools architecture-aware and restore cross-compilation functionality
[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 { }
12
13 Tool::Tool(Builder &b, const Architecture &a, const string &t):
14         builder(b),
15         architecture(&a),
16         tag(t),
17         executable(0)
18 { }
19
20 bool Tool::accepts_suffix(const string &suffix, bool aux) const
21 {
22         if(find(input_suffixes.begin(), input_suffixes.end(), suffix)!=input_suffixes.end())
23                 return true;
24         else if(aux)
25                 return find(aux_suffixes.begin(), aux_suffixes.end(), suffix)!=aux_suffixes.end();
26         else
27                 return false;
28 }
29
30 Target *Tool::create_target(Target &source, const string &arg) const
31 {
32         list<Target *> sources;
33         sources.push_back(&source);
34         return create_target(sources, arg);
35 }
36
37
38 SubTool::SubTool(Tool &p):
39         Tool(p),
40         parent(p)
41 { }