+ 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(!src)
+ continue;
+
+ if(tool->accepts_suffix(ext))
+ {
+ Target *obj = tool->create_target(*src);
+ objs.push_back(obj);
+ }
+
+ if(type==LIBRARY && install && dynamic_cast<FileTarget *>(src)->is_installable())
+ 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)
+ {
+ builder.add_primary_target(**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_dependency(*inst);
+ }
+}
+
+PathList Component::collect_source_files() const
+{
+ PathList files;
+ for(StringList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ {
+ FS::Path path(*i);
+ if(FS::is_dir(path))
+ {
+ package.get_builder().get_logger().log("files", format("Traversing %s", path));
+ list<string> sfiles = list_files(path);
+ for(list<string>::iterator j=sfiles.begin(); j!=sfiles.end(); ++j)
+ files.push_back(path / *j);
+ }
+ else
+ files.push_back(path);
+ }
+
+ return files;