+ if(type==PROGRAM || type==LIBRARY || type==MODULE)
+ {
+ list<Target *> objs;
+ for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
+ {
+ string ext = FS::extpart(FS::basename(*i));
+ const Tool *tool = toolchain.get_tool_for_suffix(ext, true);
+ if(tool)
+ {
+ Target *src = tool->create_source(*this, *i);
+ if(tool->accepts_suffix(ext))
+ {
+ Target *obj = tool->create_target(*src);
+ objs.push_back(obj);
+ }
+
+ if(type==LIBRARY && install && !dynamic_cast<FileTarget *>(src)->get_install_location().empty())
+ inst_list.push_back(src);
+ }
+ }
+
+ const Tool &linker = toolchain.get_tool("LINK");
+
+ list<Target *> results;
+ if(type==LIBRARY)
+ {
+ const Tool &archiver = toolchain.get_tool("AR");
+ results.push_back(linker.create_target(objs, "shared"));
+ results.push_back(archiver.create_target(objs));
+ }
+ else if(type==MODULE)
+ results.push_back(linker.create_target(objs, "shared"));
+ else
+ results.push_back(linker.create_target(objs));
+
+ for(list<Target *>::const_iterator i=results.begin(); i!=results.end(); ++i)
+ {
+ if(&pkg==builder.get_main_package() && deflt)
+ def_tgt->add_depend(**i);
+ else
+ world->add_depend(**i);
+ if(install)
+ inst_list.push_back(*i);
+ }
+ }
+
+ Target *inst_tgt = builder.get_target("install");
+ const Tool © = toolchain.get_tool("CP");
+ for(list<Target *>::const_iterator i=inst_list.begin(); i!=inst_list.end(); ++i)
+ {
+ Target *inst = copy.create_target(**i, inst_loc);
+ inst_tgt->add_depend(*inst);
+ }