1 #include <msp/path/utils.h>
3 #include "executable.h"
10 Link::Link(Builder &b, const Executable &exe, const Component &comp):
13 argv.push_back("g++");
15 if(comp.get_type()==Component::LIBRARY)
16 argv.push_back("-shared");
18 const BuildInfo &binfo=comp.get_build_info();
19 for(list<string>::const_iterator i=binfo.ldflags.begin(); i!=binfo.ldflags.end(); ++i)
21 for(list<string>::const_iterator i=binfo.libpath.begin(); i!=binfo.libpath.end(); ++i)
22 argv.push_back("-L"+*i);
23 for(list<string>::const_iterator i=binfo.libs.begin(); i!=binfo.libs.end(); ++i)
24 argv.push_back("-l"+*i);
27 argv.push_back(exe.get_name());
28 const list<Target *> &deps=exe.get_depends();
29 for(list<Target *>::const_iterator i=deps.begin(); i!=deps.end(); ++i)
30 argv.push_back((*i)->get_name());
32 Path::Path epath=exe.get_name();
33 Path::mkpath(epath.subpath(0, epath.size()-1), 0755);
35 announce(comp.get_package().get_name(), "LINK", relative(epath, comp.get_package().get_source()).str());