]> git.tdb.fi Git - builder.git/blobdiff - source/link.cpp
Add Symlink target and associated action
[builder.git] / source / link.cpp
index b6537d987a143e9551d893680be91f8eb29f08c8..b3e5152204b73d632478fe91a979a200e5f86b12 100644 (file)
@@ -1,7 +1,7 @@
 /* $Id$
 
 This file is part of builder
-Copyright © 2006-2009  Mikko Rasa, Mikkosoft Productions
+Copyright © 2006-2010  Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
@@ -37,6 +37,10 @@ Link::Link(Builder &b, const Binary &bin):
        else if(comp.get_package().get_library_mode()==ALL_STATIC)
                argv.push_back("-static");
 
+       if(const SharedLibrary *lib = dynamic_cast<const SharedLibrary *>(&bin))
+               if(!lib->get_soname().empty())
+                       argv.push_back("-Wl,-soname,"+lib->get_soname());
+
        const BuildInfo &binfo = comp.get_build_info();
        for(list<string>::const_iterator i=binfo.ldflags.begin(); i!=binfo.ldflags.end(); ++i)
                argv.push_back(*i);
@@ -48,9 +52,7 @@ Link::Link(Builder &b, const Binary &bin):
        const TargetList &deps = bin.get_depends();
        for(TargetList::const_iterator i=deps.begin(); i!=deps.end(); ++i)
        {
-               Target *tgt = *i;
-               if(Install *inst = dynamic_cast<Install *>(tgt))
-                       tgt = &inst->get_source();
+               Target *tgt = (*i)->get_real_target();
 
                if(ObjectFile *obj = dynamic_cast<ObjectFile *>(tgt))
                        argv.push_back(relative(obj->get_path(), work_dir).str());