+
+void Tool::prepare()
+{
+ if(prepared)
+ return;
+
+ prepared = true;
+ do_prepare();
+ if(!executable && !command.empty())
+ {
+ executable = builder.get_vfs().find_binary(command);
+ if(!executable)
+ problems.push_back(format("Can't find executable %s", command));
+ }
+}
+
+
+SubTool::SubTool(Tool &p):
+ Tool(p),
+ parent(p)
+{ }
+
+
+void operator>>(const LexicalConverter &conv, Tool::ProcessingUnit &unit)
+{
+ const string &str = conv.get();
+ if(str=="FILE")
+ unit = Tool::ONE_FILE;
+ else if(str=="DIRECTORY")
+ unit = Tool::DIRECTORY;
+ else if(str=="COMPONENT")
+ unit = Tool::COMPONENT;
+ else
+ throw lexical_error(format("conversion of '%s' to ProcessingUnit", str));
+}