]> git.tdb.fi Git - builder.git/blob - source/installcomponent.cpp
A bunch of minor cleanups
[builder.git] / source / installcomponent.cpp
1 #include "installcomponent.h"
2 #include "builder.h"
3 #include "file.h"
4 #include "sourcepackage.h"
5 #include "tool.h"
6
7 using namespace std;
8
9 InstallComponent::InstallComponent(SourcePackage &p, const string &n):
10         Component(p, n)
11 { }
12
13 void InstallComponent::create_targets() const
14 {
15         Builder &builder = package.get_builder();
16         Target *inst = builder.get_build_graph().get_target("install");
17         Tool &copy = builder.get_toolchain().get_tool("CP");
18
19         SourceList source_filenames = collect_source_files();
20         for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
21         {
22                 Target *tgt = builder.get_vfs().get_target(*i);
23                 if(!tgt)
24                         tgt = new File(builder, package, *i);
25                 inst->add_dependency(*copy.create_target(*tgt, name));
26         }
27 }