]> git.tdb.fi Git - builder.git/blobdiff - source/component.cpp
Compile libraries with -fPIC
[builder.git] / source / component.cpp
index de42d922404f995a186e80a6e62c5819faa59746..5e32de5275f12a2dc1eb1f66c3466d15b482e050 100644 (file)
@@ -13,6 +13,7 @@ Distributed under the LGPL
 #include <msp/strings/lexicalcast.h>
 #include "builder.h"
 #include "component.h"
+#include "datafile.h"
 #include "executable.h"
 #include "file.h"
 #include "header.h"
@@ -66,6 +67,10 @@ void Component::create_build_info()
                if(lexical_cast<bool>(strip))
                        build_info.ldflags.push_back("-s");
        }
+       else if(type==LIBRARY)
+       {
+               build_info.cflags.push_back("-fPIC");
+       }
 
        if(modular)
        {
@@ -136,6 +141,22 @@ void Component::create_targets() const
                        inst_list.push_back(ft);
                }
        }
+       else if(type==DATAFILE)
+       {
+               File *source;
+               if(Target *tgt=builder.get_target(files.front().str()))
+                       source=dynamic_cast<File *>(tgt);
+               else
+                       source=new File(builder, pkg, files.front());
+               ::DataFile *result=new ::DataFile(builder, *this, *source);
+
+               if(&pkg==builder.get_main_package() && deflt)
+                       def_tgt->add_depend(result);
+               else
+                       world->add_depend(result);
+               if(install)
+                       inst_list.push_back(result);
+       }
        else
        {
                for(PathList::const_iterator i=files.begin(); i!=files.end(); ++i)