]> git.tdb.fi Git - builder.git/blobdiff - source/component.cpp
Deprecate the headers component type
[builder.git] / source / component.cpp
index 902cf49abfe6d1142d0d4c50819a7cc103e0edaa..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);
                        }
                }