#include <msp/fs/dir.h>
#include <msp/fs/stat.h>
#include <msp/fs/utils.h>
-#include <msp/strings/format.h>
#include <stdexcept>
#include "builder.h"
#include "component.h"
GnuArchiver::GnuArchiver(Builder &b, const Architecture &a):
Tool(b, a, "AR")
{
- string command = "ar";
- if(architecture->is_cross())
- command = format("%s-%s", architecture->get_cross_prefix(), command);
- executable = builder.get_vfs().find_binary(command);
-
+ set_command("ar", true);
input_suffixes.push_back(".o");
}
-Target *GnuArchiver::create_target(const list<Target *> &sources, const string &) const
+Target *GnuArchiver::create_target(const list<Target *> &sources, const string &)
{
if(sources.empty())
throw invalid_argument("GnuArchiver::create_target");
if(ObjectFile *obj = dynamic_cast<ObjectFile *>(*i))
argv.push_back(relative(obj->get_path(), work_dir).str());
- if(!builder.get_dry_run())
- {
- FS::mkpath(FS::dirname(lib.get_path()), 0755);
- if(FS::exists(lib.get_path()))
- FS::unlink(lib.get_path());
- }
-
return new ExternalTask(argv, work_dir);
}