diff options
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index df50001..20e823d 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -9,6 +9,7 @@ #include "libctor.h" #include "execute.h" #include "util.h" +#include "tools.h" TaskLD::TaskLD(const BuildConfiguration& config, const Settings& settings, @@ -81,15 +82,18 @@ bool TaskLD::dirtyInner() int TaskLD::runInner() { + auto tool_chain = getToolChain(config.system); + std::vector<std::string> args; for(const auto& dep : getDependsTasks()) { auto depFile = dep->targetFile(); if(depFile.extension() == ".so") { - args.push_back(std::string("-L") + targetFile().parent_path().string()); + append(args, getOption(tool_chain, opt::library_path, + targetFile().parent_path().string())); auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix - args.push_back(std::string("-l") + lib); + append(args, getOption(tool_chain, opt::link, lib)); } else if(depFile.extension() == ".a" || depFile.extension() == ".o") { @@ -97,12 +101,8 @@ int TaskLD::runInner() } } - for(const auto& flag : config.flags.ldflags) - { - args.push_back(flag); - } - args.push_back("-o"); - args.push_back(targetFile().string()); + append(args, config.flags.ldflags); + append(args, getOption(tool_chain, opt::output, targetFile().string())); { // Write flags to file. std::ofstream flagsStream(flagsFile); |