]> git.tdb.fi Git - builder.git/blob - source/executable.cpp
2dfeee8affbbbce98ee5a812da75433ca60d32b2
[builder.git] / source / executable.cpp
1 #include "component.h"
2 #include "executable.h"
3 #include "objectfile.h"
4 #include "package.h"
5
6 using namespace std;
7
8 Executable::Executable(Builder &b, const Component &c, const list<ObjectFile *> &objs):
9         Target(b, &c.get_package(), generate_target_name(c)),
10         comp(c)
11 {
12         for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
13                 add_depend(*i);
14 }
15
16 string Executable::generate_target_name(const Component &comp)
17 {
18         string prefix;
19         string suffix;
20
21         if(comp.get_type()==Component::LIBRARY)
22         {
23                 prefix="lib";
24                 suffix=".so";
25         }
26
27         return (comp.get_package().get_source()/(prefix+comp.get_name()+suffix)).str();
28 }