From 9da7f08eb0f34f52561a62d7cf1004621b7d83c2 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 16 Jan 2023 17:51:57 +0100 Subject: Make file extensions abstract based on tool-chain type. --- src/task_ld.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/task_ld.cc') 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()); } -- cgit v1.2.3