]> git.tdb.fi Git - builder.git/commitdiff
Unify some aspects of constructor helper functions
authorMikko Rasa <tdb@tdb.fi>
Sun, 6 May 2012 21:06:42 +0000 (00:06 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 8 Jul 2012 21:08:51 +0000 (00:08 +0300)
source/filetarget.cpp
source/filetarget.h
source/staticlibrary.cpp
source/staticlibrary.h

index 2a60c2986bac2ec89f1454995f89283fe5d973da..dd20a0e8554d8cb5795af04e1e09b33fa279c2cb 100644 (file)
@@ -10,7 +10,7 @@ using namespace std;
 using namespace Msp;
 
 FileTarget::FileTarget(Builder &b, const Package *p, const FS::Path &a):
-       Target(b, make_name(p, a)),
+       Target(b, generate_name(p, a)),
        path(a),
        size(0)
 {
@@ -62,7 +62,7 @@ void FileTarget::check_rebuild()
                mark_rebuild("Package options changed");
 }
 
-string FileTarget::make_name(const Package *pkg, const FS::Path &pth)
+string FileTarget::generate_name(const Package *pkg, const FS::Path &pth)
 {
        if(const SourcePackage *spkg = dynamic_cast<const SourcePackage *>(pkg))
        {
index 4363d5a8672f5e8dfbad647570acbe1f22212db5..32092d0db05efd1bc428489684597db474215c9e 100644 (file)
@@ -29,7 +29,7 @@ public:
 protected:
        virtual void check_rebuild();
 private:
-       std::string make_name(const Package *, const Msp::FS::Path &);
+       static std::string generate_name(const Package *, const Msp::FS::Path &);
 };
 
 #endif
index f6c8e56e49fc409382e0b7c399340eb6fa60ad1e..db04f0a80ef2ec9094acbace22d7b2187b78293d 100644 (file)
@@ -12,7 +12,7 @@ StaticLibrary::StaticLibrary(Builder &b, const FS::Path &p):
 { }
 
 StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFile *> &objs):
-       FileTarget(b, &c.get_package(), generate_target_path(c))
+       FileTarget(b, &c.get_package(), c.get_package().get_out_dir()/generate_filename(c))
 {
        component = &c;
        for(list<ObjectFile *>::const_iterator i=objs.begin(); i!=objs.end(); ++i)
@@ -21,9 +21,8 @@ StaticLibrary::StaticLibrary(Builder &b, const Component &c, const list<ObjectFi
        install_location = "lib";
 }
 
-Msp::FS::Path StaticLibrary::generate_target_path(const Component &c)
+string StaticLibrary::generate_filename(const Component &comp)
 {
-       const Architecture &arch = c.get_package().get_builder().get_current_arch();
-       return c.get_package().get_out_dir()/
-               arch.get_static_library_patterns().front().apply(c.get_name());
+       const Architecture &arch = comp.get_package().get_builder().get_current_arch();
+       return arch.get_static_library_patterns().front().apply(comp.get_name());
 }
index 60b900587ecc22393070b8de7979967dfb20bdb7..451e9f8aedc5b23a35d6308738aa6d9c9fd8aadc 100644 (file)
@@ -17,7 +17,7 @@ public:
 
        virtual const char *get_type() const { return "StaticLibrary"; }
 private:
-       static Msp::FS::Path generate_target_path(const Component &);
+       static std::string generate_filename(const Component &);
 };
 
 #endif