diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-16 17:51:57 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2023-01-16 17:51:57 +0100 |
commit | 9da7f08eb0f34f52561a62d7cf1004621b7d83c2 (patch) | |
tree | 012a9620b5a52f7a1098d04a1cb6c45404e41e1b /src/task_ld.cc | |
parent | a257c2f4d333969c73d8b27124e658db6430645a (diff) |
Make file extensions abstract based on tool-chain type.
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r-- | src/task_ld.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc index 3d917e4..e619dfd 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -30,6 +30,8 @@ TaskLD::TaskLD(const ctor::build_configuration& config, std::filesystem::create_directories(std::filesystem::path(settings.builddir) / sourceDir); _targetFile = target; + auto toolchain = getToolChain(config.system); + _targetFile = extension(toolchain, target_type, _targetFile); for(const auto& object : objects) { std::filesystem::path objectFile = object; @@ -88,14 +90,16 @@ int TaskLD::runInner() for(const auto& dep : getDependsTasks()) { auto depFile = dep->targetFile(); - if(depFile.extension() == ".so") + auto dep_type = target_type_from_extension(toolchain, depFile); + if(dep_type == ctor::target_type::dynamic_library) { 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, ld_option(toolchain, ctor::ld_opt::link, lib)); } - else if(depFile.extension() == ".a" || depFile.extension() == ".o") + else if(dep_type == ctor::target_type::static_library || + dep_type == ctor::target_type::object) { args.push_back(depFile.string()); } |