diff options
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index b0aa4ae..69c3a8a 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -11,15 +11,17 @@ #include "util.h" #include "tools.h" -TaskLD::TaskLD(const ctor::build_configuration& config, - const ctor::settings& settings, +TaskLD::TaskLD(const ctor::build_configuration& config_, + const ctor::settings& settings_, const std::string& target, const std::vector<std::string>& objects, - const std::string& sourceDir) - : Task(config, settings, sourceDir) - , config(config) - , settings(settings) - , sourceDir(sourceDir) + const std::string& sourceDir_, + bool is_self_) + : Task(config_, settings_, sourceDir_) + , config(config_) + , settings(settings_) + , sourceDir(sourceDir_) + , is_self(is_self_) { target_type = config.type; output_system = config.system; @@ -41,7 +43,7 @@ TaskLD::TaskLD(const ctor::build_configuration& config, for(const auto& dep : config.depends) { - depFiles.push_back(dep); + depFiles.emplace_back(dep); } flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem(); @@ -121,11 +123,19 @@ int TaskLD::runInner() if(settings.verbose == 0) { - std::cout << "LD => " << targetFile().string() << std::endl; + std::string output = "LD => " + targetFile().string() + '\n'; + std::cout << output << std::flush; } auto tool = compiler(); - return execute(tool, args, {}, settings.verbose > 0); + const auto& c = ctor::get_configuration(); + auto res = execute(settings, tool, args, c.env, is_self); + if(res != 0) + { + std::filesystem::remove(targetFile()); + } + + return res; } int TaskLD::clean() @@ -193,7 +203,6 @@ std::string TaskLD::flagsString() const flagsStr += str; } } - flagsStr += "\n"; for(const auto& dep : config.depends) { |