diff options
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index 4915de9..3d917e4 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -90,10 +90,10 @@ int TaskLD::runInner() auto depFile = dep->targetFile(); if(depFile.extension() == ".so") { - append(args, getOption(toolchain, ctor::opt::library_path, + append(args, ld_option(toolchain, ctor::ld_opt::library_path, targetFile().parent_path().string())); auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix - append(args, getOption(toolchain, ctor::opt::link, lib)); + append(args, ld_option(toolchain, ctor::ld_opt::link, lib)); } else if(depFile.extension() == ".a" || depFile.extension() == ".o") { @@ -101,8 +101,12 @@ int TaskLD::runInner() } } - append(args, config.flags.ldflags); - append(args, getOption(toolchain, ctor::opt::output, targetFile().string())); + for(const auto& flag : config.flags.ldflags) + { + append(args, to_strings(toolchain, flag)); + } + + append(args, ld_option(toolchain, ctor::ld_opt::output, targetFile().string())); { // Write flags to file. std::ofstream flagsStream(flagsFile); @@ -168,14 +172,20 @@ bool TaskLD::derived() const std::string TaskLD::flagsString() const { + auto toolchain = getToolChain(config.system); std::string flagsStr; + bool first{true}; for(const auto& flag : config.flags.ldflags) { - if(flag != config.flags.ldflags[0]) + for(const auto& str : to_strings(toolchain, flag)) { - flagsStr += " "; + if(first) + { + flagsStr += " "; + first = false; + } + flagsStr += str; } - flagsStr += flag; } flagsStr += "\n"; |