diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-07-10 17:24:16 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-07-15 10:11:05 +0200 |
commit | ae1871ca0ffcac3e8bd337f8d8bb4e7fd6c59295 (patch) | |
tree | d15df8a03fab6bdacebb6ba53c8ad30c290781fc /src/task_ld.cc | |
parent | 2a55edcc40372403fb2de8ed20ed5c44464d416e (diff) |
Make tools abstraction around compiler options to better support tool agnostic arguments.
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); |