GnuCompiler(b, "CC", "gcc")
{
input_suffixes.push_back(".c");
+ aux_suffixes.push_back(".h");
}
Target *GnuCCompiler::create_source(const Component &comp, const FS::Path &path) const
{
input_suffixes.push_back(".cpp");
input_suffixes.push_back(".cc");
+ aux_suffixes.push_back(".hpp");
}
Target *GnuCxxCompiler::create_source(const Component &comp, const FS::Path &path) const
tag(t)
{ }
-bool Tool::accepts_suffix(const string &suffix) const
+bool Tool::accepts_suffix(const string &suffix, bool aux) const
{
- return find(input_suffixes.begin(), input_suffixes.end(), suffix)!=input_suffixes.end();
+ if(find(input_suffixes.begin(), input_suffixes.end(), suffix)!=input_suffixes.end())
+ return true;
+ else if(aux)
+ return find(aux_suffixes.begin(), aux_suffixes.end(), suffix)!=aux_suffixes.end();
+ else
+ return false;
}
Target *Tool::create_target(Target &source, const string &arg) const
class Tool
{
+public:
+ typedef std::list<std::string> SuffixList;
+
protected:
Builder &builder;
std::string tag;
- std::list<std::string> input_suffixes;
+ SuffixList input_suffixes;
+ SuffixList aux_suffixes;
Tool(Builder &, const std::string &);
public:
virtual ~Tool() { }
const std::string &get_tag() const { return tag; }
- const std::list<std::string> &get_input_suffixes() const { return input_suffixes; }
- bool accepts_suffix(const std::string &) const;
+ const SuffixList &get_input_suffixes() const { return input_suffixes; }
+ const SuffixList &get_auxiliary_suffixes() const { return aux_suffixes; }
+ bool accepts_suffix(const std::string &, bool = false) const;
virtual Target *create_source(const Component &, const Msp::FS::Path &) const { return 0; }
Target *create_target(Target &, const std::string & = std::string()) const;
return *get_item(tools, tag);
}
-const Tool *Toolchain::get_tool_for_suffix(const string &suffix) const
+const Tool *Toolchain::get_tool_for_suffix(const string &suffix, bool aux) const
{
for(ToolMap::const_iterator i=tools.begin(); i!=tools.end(); ++i)
- if(i->second->accepts_suffix(suffix))
+ if(i->second->accepts_suffix(suffix, aux))
return i->second;
return 0;
void add_tool(Tool *);
const Tool &get_tool(const std::string &) const;
- const Tool *get_tool_for_suffix(const std::string &) const;
+ const Tool *get_tool_for_suffix(const std::string &, bool = false) const;
};
#endif