]> git.tdb.fi Git - builder.git/blobdiff - source/sharedlibrary.cpp
Split Binary filename generation to Executable and SharedLibrary
[builder.git] / source / sharedlibrary.cpp
index d3a8ceb25568e8f4077cc077f3deeb3dea69062a..9f983ef1d666fc7a690ed17da7a7cdb135e7ccaf 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/fs/utils.h>
 #include <msp/strings/format.h>
+#include "builder.h"
 #include "component.h"
 #include "sharedlibrary.h"
 #include "sourcepackage.h"
@@ -16,7 +17,7 @@ SharedLibrary::SharedLibrary(Builder &b, const Msp::FS::Path &p):
 }
 
 SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
-       Binary(b, c, objs),
+       Binary(b, c, generate_filename(c), objs),
        libname(c.get_name()),
        soname(create_soname(c))
 {
@@ -28,6 +29,17 @@ SharedLibrary::SharedLibrary(Builder &b, const Component &c, const list<ObjectFi
        }
 }
 
+string SharedLibrary::generate_filename(const Component &comp)
+{
+       if(comp.get_type()==Component::MODULE)
+               return comp.get_name()+".m";
+       else
+       {
+               const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+               return arch.get_shared_library_patterns().front().apply(comp.get_name());
+       }
+}
+
 string SharedLibrary::create_soname(const Component &c)
 {
        const string &ver = c.get_package().get_version();