]> git.tdb.fi Git - builder.git/blob - source/staticlibrary.cpp
c5998867ecb2368a11b3cd0bb59648d84e6442fb
[builder.git] / source / staticlibrary.cpp
1 /* $Id$
2
3 This file is part of builder
4 Copyright © 2006-2009  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "archive.h"
9 #include "component.h"
10 #include "objectfile.h"
11 #include "sourcepackage.h"
12 #include "staticlibrary.h"
13
14 using namespace std;
15
16 StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
17         FileTarget(b, &c.get_package(), generate_target_path(c)),
18         Library(b, package, path, c.get_name()),
19         comp(c)
20 {
21         buildable = true;
22         for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
23                 add_depend(*i);
24 }
25
26 Action *StaticLibrary::create_action()
27 {
28         return new Archive(builder, *this);
29 }
30
31 Msp::FS::Path StaticLibrary::generate_target_path(const Component &c)
32 {
33         return c.get_package().get_out_dir()/("lib"+c.get_name()+".a");
34 }