diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-13 19:56:35 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-13 22:32:09 +0100 |
commit | 916060cb53fddb94f64b20d3616e7360c5e91f64 (patch) | |
tree | 4a2bcef4672b5e04b106f88cca3bec631b214c00 /src/task_so.cc | |
parent | c093758b4688fb5bae2cc7727b6c9b52b824043e (diff) |
Capture flags in a class instead of a string and add conversion functions between them.
Diffstat (limited to 'src/task_so.cc')
-rw-r--r-- | src/task_so.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/task_so.cc b/src/task_so.cc index 93a5ddb..9061591 100644 --- a/src/task_so.cc +++ b/src/task_so.cc @@ -83,17 +83,20 @@ int TaskSO::runInner() std::vector<std::string> args; - append(args, getOption(toolchain, ctor::opt::position_independent_code)); - append(args, getOption(toolchain, ctor::opt::build_shared)); + append(args, ld_option(toolchain, ctor::ld_opt::position_independent_code)); + append(args, ld_option(toolchain, ctor::ld_opt::build_shared)); - append(args, getOption(toolchain, ctor::opt::output, targetFile().string())); + append(args, ld_option(toolchain, ctor::ld_opt::output, targetFile().string())); for(const auto& task : getDependsTasks()) { args.push_back(task->targetFile().string()); } - append(args, config.flags.ldflags); + for(const auto& flag : config.flags.ldflags) + { + append(args, to_strings(toolchain, flag)); + } { // Write flags to file. std::ofstream flagsStream(flagsFile); @@ -159,10 +162,20 @@ bool TaskSO::derived() const std::string TaskSO::flagsString() const { - std::string flagsStr = compiler(); + auto toolchain = getToolChain(config.system); + std::string flagsStr; + bool first{true}; for(const auto& flag : config.flags.ldflags) { - flagsStr += " " + flag; + for(const auto& str : to_strings(toolchain, flag)) + { + if(first) + { + flagsStr += " "; + first = false; + } + flagsStr += str; + } } flagsStr += "\n"; |