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));
+ Target *inst_tgt = 0;
+ if(const Tool *tool = t.get_tool())
+ inst_tgt = tool->create_install(t);
+ if(!inst_tgt)
+ inst_tgt = toolchain.get_tool("CP").create_target(t);
+ get_target("install")->add_dependency(*inst_tgt);
}
void Builder::usage(const char *reason, const char *argv0, bool brief)
alternative target type for tools that can create multiple kinds of targets. */
virtual Target *create_target(const std::list<Target *> &, const std::string & = std::string()) const = 0;
+ /** Creates an install target for a target created by this tool. Can return
+ null if the tool does not want to handle installing in a special way. */
+ virtual Target *create_install(Target &) const { return 0; }
+
virtual std::string create_build_signature(const BuildInfo &) const { return std::string(); }
/** Invokes the tool to build a target. This should not be called directly;