get_target("default")->add_dependency(t);
}
+void Builder::add_installed_target(Target &t)
+{
+ Target *install = get_target("install");
+ const Tool © = toolchain.get_tool("CP");
+ install->add_dependency(*copy.create_target(t));
+}
+
void Builder::usage(const char *reason, const char *argv0, bool brief)
{
if(reason)
virtual target. */
void add_primary_target(Target &);
+ /** Adds a target that will be installed. A new InstalledFile target is
+ created and added as a dependency to the "install" virtual target. */
+ void add_installed_target(Target &);
+
void problem(const std::string &, const std::string &);
static void usage(const char *, const char *, bool);
const Toolchain &toolchain = builder.get_toolchain();
SourceList source_filenames = collect_source_files();
- list<Target *> inst_list;
string inst_loc;
if(type==TARBALL)
}
else if(type==INSTALL)
{
- inst_loc = name;
+ Target *inst = builder.get_target("install");
+ const Tool © = toolchain.get_tool("CP");
for(SourceList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
FileTarget *ft;
ft = dynamic_cast<FileTarget *>(tgt);
else
ft = new File(builder, package, *i);
- inst_list.push_back(ft);
+ inst->add_dependency(*copy.create_target(*ft, name));
}
}
else if(type==DATAFILE)
builder.add_primary_target(*result);
if(install)
- inst_list.push_back(result);
+ builder.add_installed_target(*result);
}
if(type==PROGRAM || type==LIBRARY || type==MODULE)
}
if(type==LIBRARY && install && dynamic_cast<FileTarget *>(src)->is_installable())
- inst_list.push_back(src);
+ builder.add_installed_target(*src);
}
}
{
builder.add_primary_target(**i);
if(install)
- inst_list.push_back(*i);
+ builder.add_installed_target(**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);
- }
}
Component::SourceList Component::collect_source_files() const