X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgnuarchiver.cpp;h=170007028a5201f26bf64160402a2bab3f8bebd7;hb=HEAD;hp=2f5ba24d6068d7c3f9c5d695b502a87d955f3d5c;hpb=1ed833343bc83b83c5f61cbfd74423bbba677a04;p=builder.git diff --git a/source/gnuarchiver.cpp b/source/gnuarchiver.cpp deleted file mode 100644 index 2f5ba24..0000000 --- a/source/gnuarchiver.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include -#include -#include -#include -#include "builder.h" -#include "component.h" -#include "externaltask.h" -#include "gnuarchiver.h" -#include "objectfile.h" -#include "sourcepackage.h" -#include "staticlibrary.h" - -using namespace std; -using namespace Msp; - -GnuArchiver::GnuArchiver(Builder &b, const Architecture &a): - Tool(b, a, "AR") -{ - set_command("ar", true); - input_suffixes.push_back(".o"); - processing_unit = COMPONENT; - set_run(_run); -} - -Target *GnuArchiver::create_target(const vector &sources, const string &) -{ - if(sources.empty()) - throw invalid_argument("GnuArchiver::create_target"); - - vector objs; - objs.reserve(sources.size()); - for(Target *s: sources) - objs.push_back(&dynamic_cast(*s)); - - const Component &comp = *objs.front()->get_component(); - StaticLibrary *lib = new StaticLibrary(builder, comp, objs); - lib->set_tool(*this); - return lib; -} - -Task *GnuArchiver::_run(const StaticLibrary &lib) -{ - const Tool &tool = *lib.get_tool(); - const Component &comp = *lib.get_component(); - - vector argv; - argv.push_back(tool.get_executable()->get_path().str()); - argv.push_back("rc"); - - FS::Path work_dir = comp.get_package().get_source_directory(); - - argv.push_back(relative(lib.get_path(), work_dir).str()); - - for(Target *d: lib.get_dependencies()) - if(ObjectFile *obj = dynamic_cast(d)) - argv.push_back(relative(obj->get_path(), work_dir).str()); - - return new ExternalTask(argv, work_dir); -}