summaryrefslogtreecommitdiff
path: root/src/task_so.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2022-07-10 17:24:16 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2022-07-15 10:11:05 +0200
commitae1871ca0ffcac3e8bd337f8d8bb4e7fd6c59295 (patch)
treed15df8a03fab6bdacebb6ba53c8ad30c290781fc /src/task_so.cc
parent2a55edcc40372403fb2de8ed20ed5c44464d416e (diff)
Make tools abstraction around compiler options to better support tool agnostic arguments.
Diffstat (limited to 'src/task_so.cc')
-rw-r--r--src/task_so.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/task_so.cc b/src/task_so.cc
index 2bd27c4..8c6dbd4 100644
--- a/src/task_so.cc
+++ b/src/task_so.cc
@@ -9,6 +9,7 @@
#include "libctor.h"
#include "execute.h"
#include "util.h"
+#include "tools.h"
TaskSO::TaskSO(const BuildConfiguration& config,
const Settings& settings,
@@ -78,23 +79,21 @@ bool TaskSO::dirtyInner()
int TaskSO::runInner()
{
+ auto tool_chain = getToolChain(config.system);
+
std::vector<std::string> args;
- args.push_back("-fPIC");
- args.push_back("-shared");
+ append(args, getOption(tool_chain, opt::position_independent_code));
+ append(args, getOption(tool_chain, opt::build_shared));
- args.push_back("-o");
- args.push_back(targetFile().string());
+ append(args, getOption(tool_chain, opt::output, targetFile().string()));
for(const auto& task : getDependsTasks())
{
args.push_back(task->targetFile().string());
}
- for(const auto& flag : config.flags.ldflags)
- {
- args.push_back(flag);
- }
+ append(args, config.flags.ldflags);
{ // Write flags to file.
std::ofstream flagsStream(flagsFile);