]> git.tdb.fi Git - builder.git/commitdiff
Add and improve build signatures for some tools
authorMikko Rasa <tdb@tdb.fi>
Wed, 25 Sep 2013 17:18:52 +0000 (20:18 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 25 Sep 2013 17:18:52 +0000 (20:18 +0300)
source/datatool.cpp
source/datatool.h
source/gnuarchiver.cpp
source/gnuarchiver.h
source/gnulinker.cpp

index 9b101c7bf6187332636615af74a058ed06127c2f..5ce7c02b7b21346df7b471bd04e2817e1f486e06 100644 (file)
@@ -48,6 +48,20 @@ Target *DataTool::create_target(const list<Target *> &sources, const string &arg
                throw invalid_argument("DataTool::create_target");
 }
 
+string DataTool::create_build_signature(const BuildInfo &binfo) const
+{
+       string result;
+       if(binfo.debug)
+               result += 'g';
+       if(binfo.optimize>0)
+       {
+               result += 'b';
+               if(binfo.optimize>1)
+                       result += 'z';
+       }
+       return result;
+}
+
 Task *DataTool::run(const Target &tgt) const
 {
        const Component &comp = *tgt.get_component();
index 264ddc1523527a615be087f41faf4f8fa542e8b8..e89861240a78291edd647d4fe3d8b4f084ee8499 100644 (file)
@@ -10,6 +10,7 @@ public:
 
        virtual Target *create_source(const Component &, const Msp::FS::Path &) const;
        virtual Target *create_target(const std::list<Target *> &, const std::string &);
+       virtual std::string create_build_signature(const BuildInfo &) const;
        virtual Task *run(const Target &) const;
 };
 
index 6cf4adb90f80c0df53ff686e5da0e42d04c0ae31..158a4d4fee9f70c359d4e22ea1c6255aa82c098f 100644 (file)
@@ -40,6 +40,11 @@ Target *GnuArchiver::create_target(const list<Target *> &sources, const string &
        return lib;
 }
 
+string GnuArchiver::create_build_signature(const BuildInfo &) const
+{
+       return FS::basename(executable->get_path());
+}
+
 Task *GnuArchiver::run(const Target &target) const
 {
        const StaticLibrary &lib = dynamic_cast<const StaticLibrary &>(target);
index eab49339af07d0223f48fe5fdc783900bc227298..f7d90ab4df675c4835894f1de69a4e5120addf66 100644 (file)
@@ -9,6 +9,7 @@ public:
        GnuArchiver(Builder &, const Architecture &);
 
        virtual Target *create_target(const std::list<Target *> &, const std::string &);
+       virtual std::string create_build_signature(const BuildInfo &) const;
        virtual Task *run(const Target &) const;
 };
 
index a56d716780817cdd63f3e9536584bc242ac19b78..837e7c7e64ff5baed9926ab1db5006a8f924245f 100644 (file)
@@ -144,8 +144,11 @@ string GnuLinker::Linker::create_build_signature(const BuildInfo &binfo) const
                result += 'd';
        if(binfo.strip)
                result += 's';
-       result += ",l";
-       result += join(binfo.libs.begin(), binfo.libs.end(), ",l");
+       if(!binfo.libs.empty())
+       {
+               result += ",l";
+               result += join(binfo.libs.begin(), binfo.libs.end(), ",l");
+       }
        return result;
 }