+#include "builder.h"
#include "component.h"
#include "objectfile.h"
#include "sourcepackage.h"
#include "staticlibrary.h"
using namespace std;
+using namespace Msp;
+
+StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p):
+ FileTarget(b, p)
+{ }
StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
- FileTarget(b, &c.get_package(), generate_target_path(c)),
- Library(b, package, path, c.get_name()),
- comp(c)
+ FileTarget(b, c.get_package(), c.get_package().get_out_dir()/generate_filename(c))
{
- buildable = true;
+ component = &c;
for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
- add_depend(*i);
+ add_dependency(**i);
+
+ install_location = "lib";
}
-Msp::FS::Path StaticLibrary::generate_target_path(const Component &c)
+string StaticLibrary::generate_filename(const Component &comp)
{
- return c.get_package().get_out_dir()/("lib"+c.get_name()+".a");
+ const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+ return arch.get_static_library_patterns().front().apply(comp.get_name());
}