+#include "builder.h"
#include "component.h"
#include "executable.h"
-#include "objectfile.h"
-#include "package.h"
+#include "sourcepackage.h"
using namespace std;
+using namespace Msp;
-Executable::Executable(Builder &b, const Component &c, const list<ObjectFile *> &objs):
- Target(b, &c.get_package(), generate_target_name(c)),
- comp(c)
+Executable::Executable(Builder &b, const Component &c, const std::list<ObjectFile *> &objs):
+ Binary(b, c, generate_filename(c), objs)
{
- for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
- add_depend(*i);
+ install_location = "bin";
}
-string Executable::generate_target_name(const Component &comp)
+string Executable::generate_filename(const Component &comp)
{
- string prefix;
- string suffix;
-
- if(comp.get_type()==Component::LIBRARY)
- {
- prefix="lib";
- suffix=".so";
- }
-
- return (comp.get_package().get_source()/(prefix+comp.get_name()+suffix)).str();
+ const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+ return arch.get_executable_patterns().front().apply(comp.get_name());
}