]> git.tdb.fi Git - builder.git/commitdiff
Get rid of separate header targets which serve no useful purpose
authorMikko Rasa <tdb@tdb.fi>
Tue, 1 May 2012 08:18:21 +0000 (11:18 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:49 +0000 (00:08 +0300)
source/builder.cpp
source/component.cpp
source/header.h [deleted file]
source/installedfile.cpp
source/sourcefile.cpp
source/sourcefile.h
source/virtualfilesystem.cpp

index 9c8e27be0aaa6cb3506d53ea22828c6dbc75f22d..6623c2d033423981a5930016936756cc67c6fb3d 100644 (file)
@@ -21,7 +21,6 @@
 #include "gnuccompiler.h"
 #include "gnucxxcompiler.h"
 #include "gnulinker.h"
-#include "header.h"
 #include "installedfile.h"
 #include "misc.h"
 #include "package.h"
index 7ef6dbed43ef0262cc1f4a0411c4ad10dbf38802..a340f3cc28b00efb091341ad6e3a593f9375e071 100644 (file)
@@ -9,9 +9,9 @@
 #include "datafile.h"
 #include "executable.h"
 #include "file.h"
-#include "header.h"
 #include "objectfile.h"
 #include "sharedlibrary.h"
+#include "sourcefile.h"
 #include "sourcepackage.h"
 #include "staticlibrary.h"
 #include "tarball.h"
@@ -169,7 +169,7 @@ void Component::create_targets() const
                        {
                                FileTarget *hdr = builder.get_vfs().get_target(*i);
                                if(!hdr)
-                                       hdr = new Header(builder, *this, i->str());
+                                       hdr = new SourceFile(builder, *this, *i);
 
                                // Install headers if requested
                                if(type==HEADERS && install)
diff --git a/source/header.h b/source/header.h
deleted file mode 100644 (file)
index 445fc9c..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef HEADER_H_
-#define HEADER_H_
-
-#include "component.h"
-#include "sourcefile.h"
-
-/**
-Represents a header file.  Mainly exists to give extra information to the user.
-*/
-class Header: public SourceFile
-{
-protected:
-       Header(Builder &b, const std::string &f): SourceFile(b, f) { }
-public:
-       Header(Builder &b, const Component &c, const std::string &f): SourceFile(b, c, f) { install_location = "include/"+c.get_name(); }
-       virtual const char *get_type() const { return "Header"; }
-};
-
-/**
-A header file that doesn't belong to any known package.
-*/
-class SystemHeader: public Header
-{
-public:
-       SystemHeader(Builder &b, const std::string &f): Header(b, f) { }
-       virtual const char *get_type() const { return "SystemHeader"; }
-};
-
-#endif
index a9c34733837ac2e4902b5cdb15146d10ae9c6af7..d0aa832b9fe8e7bf2dbaa5b442fc3582861ef19f 100644 (file)
@@ -3,7 +3,6 @@
 #include "copy.h"
 #include "executable.h"
 #include "datafile.h"
-#include "header.h"
 #include "installedfile.h"
 #include "package.h"
 #include "pkgconfig.h"
index 062665c22d2fda44636d1c591eba55a3c01deb8e..6fd8eb8d56514819f6c52bc3d25207e11ecbcad7 100644 (file)
@@ -18,7 +18,11 @@ SourceFile::SourceFile(Builder &b, const FS::Path &p):
 SourceFile::SourceFile(Builder &b, const Component &c, const FS::Path &p):
        FileTarget(b, &c.get_package(), p),
        comp(&c)
-{ }
+{
+       string ext = FS::extpart(FS::basename(path));
+       if(ext==".h" || ext==".H" || ext==".hpp")
+               install_location = "include/"+comp->get_name();
+}
 
 void SourceFile::find_depends()
 {
index 18d86045cdee8092c83e834371603ca93490c5e3..49a43318866de078484e23ce69e74877e9a4f7b9 100644 (file)
@@ -14,10 +14,10 @@ private:
        const Component *comp;
        StringList includes;
 
-protected:
-       SourceFile(Builder &, const Msp::FS::Path &);
 public:
+       SourceFile(Builder &, const Msp::FS::Path &);
        SourceFile(Builder &, const Component &, const Msp::FS::Path &);
+
        virtual const char *get_type() const { return "SourceFile"; }
        const StringList &get_includes() const { return includes; }
        const Component *get_component() const { return comp; }
index e89b2dd61c0a6978cd3dd8cb9d9711375bb57d02..76c05d9cbaf4aa58da177a324685119e89cdf19d 100644 (file)
@@ -3,8 +3,8 @@
 #include <msp/strings/utils.h>
 #include "builder.h"
 #include "misc.h"
-#include "header.h"
 #include "sharedlibrary.h"
+#include "sourcefile.h"
 #include "systemlibrary.h"
 #include "virtualfilesystem.h"
 
@@ -150,7 +150,7 @@ FileTarget *VirtualFileSystem::get_header(const FS::Path &fn)
 
        if(FS::is_reg(fn))
        {
-               tgt = new SystemHeader(builder, fn.str());
+               tgt = new SourceFile(builder, fn);
                return tgt;
        }
        return 0;