if(install)
inst_list.push_back(result);
}
- else
- {
- for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
- {
- string ext = FS::extpart(FS::basename(*i));
- if(ext==".h")
- {
- FileTarget *hdr = builder.get_vfs().get_target(*i);
- if(!hdr)
- hdr = new CSourceFile(builder, *this, *i);
-
- // Install headers if requested
- if(type==HEADERS && install)
- inst_list.push_back(hdr);
- }
- }
- }
if(type==PROGRAM || type==LIBRARY || type==MODULE)
{
for(PathList::const_iterator i=source_filenames.begin(); i!=source_filenames.end(); ++i)
{
string ext = FS::extpart(FS::basename(*i));
- const Tool *tool = toolchain.get_tool_for_suffix(ext);
+ const Tool *tool = toolchain.get_tool_for_suffix(ext, true);
if(tool)
{
Target *src = tool->create_source(*this, *i);
- Target *obj = tool->create_target(*src);
- objs.push_back(obj);
+ if(tool->accepts_suffix(ext))
+ {
+ Target *obj = tool->create_target(*src);
+ objs.push_back(obj);
+ }
+
+ if(type==LIBRARY && install && !dynamic_cast<FileTarget *>(src)->get_install_location().empty())
+ inst_list.push_back(src);
}
}
if(i->get_type()==Component::PROGRAM)
flags |= BIN;
else if(i->get_type()==Component::LIBRARY || i->get_type()==Component::MODULE)
- flags |= LIB;
- else if(i->get_type()==Component::HEADERS)
- flags |= INCLUDE;
+ flags |= LIB|INCLUDE;
}
return flags;
for(ComponentList::const_iterator i=components.begin(); i!=components.end(); ++i)
{
i->create_targets();
- if(i->get_type()==Component::LIBRARY || i->get_type()==Component::HEADERS)
+ if(i->get_type()==Component::LIBRARY)
pc_needed = true;
}
add("program", &Loader::component<Component::PROGRAM>);
add("library", &Loader::component<Component::LIBRARY>);
add("module", &Loader::component<Component::MODULE>);
- add("headers", &Loader::component<Component::HEADERS>);
+ add("headers", &Loader::headers);
add("install", &Loader::component<Component::INSTALL>);
add("datafile", &Loader::component<Component::DATAFILE>);
add("tarball", &Loader::tarball);
{
SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
spkg.components.sort(component_sort);
+
+ for(map<string, string>::const_iterator i=install_map.begin(); i!=install_map.end(); ++i)
+ {
+ for(ComponentList::iterator j=spkg.components.begin(); j!=spkg.components.end(); ++j)
+ {
+ const StringList &sources = j->get_sources();
+ for(StringList::const_iterator k=sources.begin(); k!=sources.end(); ++k)
+ {
+ if(!i->first.compare(0, k->size(), *k))
+ {
+ const_cast<InstallMap &>(j->get_install_map()).add_mapping(spkg.source/i->first, i->second);
+ }
+ }
+ }
+ }
}
void SourcePackage::Loader::feature(const string &n, const string &d)
load_sub(static_cast<SourcePackage &>(pkg).build_info);
}
+void SourcePackage::Loader::headers(const string &n)
+{
+ IO::print("%s: Note: headers components are deprecated\n", get_source());
+ SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
+ Component comp(spkg, Component::LIBRARY, n);
+ load_sub(comp);
+ const StringList &sources = comp.get_sources();
+ for(StringList::const_iterator i=sources.begin(); i!=sources.end(); ++i)
+ install_map[*i] = "include/"+comp.get_name();
+}
+
void SourcePackage::Loader::tarball(const string &n)
{
SourcePackage &spkg = static_cast<SourcePackage &>(pkg);
class Loader: public Package::Loader
{
+ private:
+ std::map<std::string, std::string> install_map;
+
public:
Loader(Package &);
SourcePackage &get_object() { return static_cast<SourcePackage &>(pkg); }
void component(const std::string &);
void condition(const std::string &);
void build_info();
+ void headers(const std::string &);
void tarball(const std::string &);
void tar_file(const std::string &);
};