From: Mikko Rasa Date: Tue, 1 May 2012 08:18:21 +0000 (+0300) Subject: Get rid of separate header targets which serve no useful purpose X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b1f8964a6b466f9b0c86e82706bf9e72133ecfcf;p=builder.git Get rid of separate header targets which serve no useful purpose --- diff --git a/source/builder.cpp b/source/builder.cpp index 9c8e27b..6623c2d 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -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" diff --git a/source/component.cpp b/source/component.cpp index 7ef6dbe..a340f3c 100644 --- a/source/component.cpp +++ b/source/component.cpp @@ -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 index 445fc9c..0000000 --- a/source/header.h +++ /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 diff --git a/source/installedfile.cpp b/source/installedfile.cpp index a9c3473..d0aa832 100644 --- a/source/installedfile.cpp +++ b/source/installedfile.cpp @@ -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" diff --git a/source/sourcefile.cpp b/source/sourcefile.cpp index 062665c..6fd8eb8 100644 --- a/source/sourcefile.cpp +++ b/source/sourcefile.cpp @@ -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() { diff --git a/source/sourcefile.h b/source/sourcefile.h index 18d8604..49a4331 100644 --- a/source/sourcefile.h +++ b/source/sourcefile.h @@ -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; } diff --git a/source/virtualfilesystem.cpp b/source/virtualfilesystem.cpp index e89b2dd..76c05d9 100644 --- a/source/virtualfilesystem.cpp +++ b/source/virtualfilesystem.cpp @@ -3,8 +3,8 @@ #include #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;