From: Mikko Rasa Date: Wed, 25 Sep 2013 17:18:52 +0000 (+0300) Subject: Add and improve build signatures for some tools X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=000deb52a1374bcedfec5d201c53c1842438ceba;p=builder.git Add and improve build signatures for some tools --- diff --git a/source/datatool.cpp b/source/datatool.cpp index 9b101c7..5ce7c02 100644 --- a/source/datatool.cpp +++ b/source/datatool.cpp @@ -48,6 +48,20 @@ Target *DataTool::create_target(const list &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(); diff --git a/source/datatool.h b/source/datatool.h index 264ddc1..e898612 100644 --- a/source/datatool.h +++ b/source/datatool.h @@ -10,6 +10,7 @@ public: virtual Target *create_source(const Component &, const Msp::FS::Path &) const; virtual Target *create_target(const std::list &, const std::string &); + virtual std::string create_build_signature(const BuildInfo &) const; virtual Task *run(const Target &) const; }; diff --git a/source/gnuarchiver.cpp b/source/gnuarchiver.cpp index 6cf4adb..158a4d4 100644 --- a/source/gnuarchiver.cpp +++ b/source/gnuarchiver.cpp @@ -40,6 +40,11 @@ Target *GnuArchiver::create_target(const list &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(target); diff --git a/source/gnuarchiver.h b/source/gnuarchiver.h index eab4933..f7d90ab 100644 --- a/source/gnuarchiver.h +++ b/source/gnuarchiver.h @@ -9,6 +9,7 @@ public: GnuArchiver(Builder &, const Architecture &); virtual Target *create_target(const std::list &, const std::string &); + virtual std::string create_build_signature(const BuildInfo &) const; virtual Task *run(const Target &) const; }; diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index a56d716..837e7c7 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -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; }