X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=plugins%2Fgnu%2Fgnulinker.cpp;h=3d81fcca6156236a58d9f943dc05136eb1d8ff9b;hb=52719526cc36271872280b987c7bf2393073f98b;hp=c8e6606d8d540691692c361bc4efd8e3995a463e;hpb=ccead1c6c820970e3ae37992b76f99675852d7f9;p=builder.git diff --git a/plugins/gnu/gnulinker.cpp b/plugins/gnu/gnulinker.cpp index c8e6606..3d81fcc 100644 --- a/plugins/gnu/gnulinker.cpp +++ b/plugins/gnu/gnulinker.cpp @@ -37,6 +37,19 @@ Target *GnuLinker::create_target(const vector &sources, const string & { if(sources.empty()) throw invalid_argument("GnuLinker::create_target"); + + if(arg=="import") + { + if(sources.size()!=1) + throw invalid_argument("GnuLinker::create_target"); + SharedLibrary &shlib = dynamic_cast(*sources.front()); + if(architecture->get_system()!="windows") + return 0; + + Tool &dlltool = builder.get_toolchain().get_tool("DLL"); + return dlltool.create_target(shlib); + } + vector objs; objs.reserve(sources.size()); for(Target *s: sources) @@ -45,15 +58,7 @@ Target *GnuLinker::create_target(const vector &sources, const string & const Component &comp = *objs.front()->get_component(); Binary *bin = 0; if(arg=="shared") - { - SharedLibrary *shlib = new SharedLibrary(builder, comp, objs); - if(architecture->get_system()=="windows") - { - Tool &dlltool = builder.get_toolchain().get_tool("DLL"); - dlltool.create_target(*shlib); - } - bin = shlib; - } + bin = new SharedLibrary(builder, comp, objs); else bin = new Executable(builder, comp, objs); bin->set_tool(*this); @@ -66,9 +71,7 @@ Target *GnuLinker::create_install(Target &target) const { Tool © = builder.get_toolchain().get_tool("CP"); InstalledFile *inst_tgt = dynamic_cast(copy.create_target(target)); - if(architecture->get_system()=="windows") - builder.get_build_graph().add_installed_target(*shlib->get_import_library()); - else + if(architecture->get_system()!="windows") { string link_name = architecture->create_filename(shlib->get_libname()); if(link_name!=FS::basename(inst_tgt->get_path()))