]> git.tdb.fi Git - builder.git/blobdiff - source/component.cpp
Deprecate the headers component type
[builder.git] / source / component.cpp
index 3c5a40945ed56184e4776edd7cb74b0ec3ee5b91..f5ca812169c3d4b4910289c4bf97a8d1962fd502 100644 (file)
@@ -158,23 +158,6 @@ void Component::create_targets() const
                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)
        {
@@ -182,12 +165,18 @@ void Component::create_targets() const
                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);
                        }
                }
 
@@ -256,17 +245,6 @@ Component::Loader::Loader(Component &c):
        add("default",         &Component::deflt);
 }
 
-void Component::Loader::finish()
-{
-       if(!inst_hdr.empty())
-       {
-               Component hdrcomp(comp.pkg, HEADERS, inst_hdr);
-               hdrcomp.sources = comp.sources;
-               hdrcomp.install = true;
-               const_cast<ComponentList &>(comp.pkg.get_components()).push_back(hdrcomp);
-       }
-}
-
 void Component::Loader::source(const string &s)
 {
        comp.sources.push_back(s);