- const Tool &tar = toolchain.get_tool("TAR");
-
- list<Target *> files;
- for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
- {
- FileTarget *file = builder.get_vfs().get_target(*i);
- if(!file)
- file = new File(builder, package, *i);
- files.push_back(file);
- }
-
- string tarname = name;
- if(name=="@src")
- {
- tarname = package.get_name()+"-"+package.get_version();
- files.insert(files.begin(), &package.get_build_file());
-
- const BuildGraph::TargetMap &targets = build_graph.get_targets();
- for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i)
- if(i->second->get_package()==&package && !i->second->is_buildable())
- if(find(files.begin(), files.end(), i->second)==files.end())
- files.push_back(i->second);
- }
-
- Target *result = tar.create_target(files, tarname);
-
- build_graph.get_target("tarballs")->add_dependency(*result);
-
- return;
- }
- else if(type==INSTALL)
- {
- Target *inst = build_graph.get_target("install");
- const Tool © = toolchain.get_tool("CP");
- for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
- {
- FileTarget *ft;
- if(Target *tgt = builder.get_vfs().get_target(*i))
- ft = dynamic_cast<FileTarget *>(tgt);
- else
- ft = new File(builder, package, *i);
- inst->add_dependency(*copy.create_target(*ft, name));
- }
- }
- else if(type==DATAFILE)
- {
- const Tool &dcomp = toolchain.get_tool("DATA");
-
- File *source;
- if(Target *tgt = builder.get_vfs().get_target(source_filenames.front()))
- source = dynamic_cast<File *>(tgt);
- else
- source = new File(builder, package, source_filenames.front());
- Target *result = dcomp.create_target(*source);
-
- build_graph.add_primary_target(*result);
- if(install)
- build_graph.add_installed_target(*result);
- }
-
- if(type==PROGRAM || type==LIBRARY || type==MODULE)
- {
- list<Target *> objs;
- for(SourceList::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)