summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2022-06-16 18:46:34 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2022-06-16 18:46:34 +0200
commitb1b290b0e3cad1b362ec56a7aeb8db05e63007da (patch)
treef59ab8a8e865407cae86ea60cefb9061ba74c4e4
parent7a16146600384272baf7fb2fc0fc64f59b17ffe9 (diff)
Fix dependency search and linking for ld and so targets.
-rw-r--r--src/task_ld.cc2
-rw-r--r--src/task_so.cc11
2 files changed, 3 insertions, 10 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc
index 3e05fb1..df50001 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -87,7 +87,7 @@ int TaskLD::runInner()
auto depFile = dep->targetFile();
if(depFile.extension() == ".so")
{
- args.push_back(std::string("-L") + settings.builddir);
+ args.push_back(std::string("-L") + targetFile().parent_path().string());
auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix
args.push_back(std::string("-l") + lib);
}
diff --git a/src/task_so.cc b/src/task_so.cc
index 1af14b5..2bd27c4 100644
--- a/src/task_so.cc
+++ b/src/task_so.cc
@@ -33,9 +33,7 @@ TaskSO::TaskSO(const BuildConfiguration& config,
for(const auto& dep : config.depends)
{
- std::filesystem::path depFile = settings.builddir;
- depFile /= dep;
- depFiles.push_back(depFile);
+ depFiles.push_back(dep);
}
flagsFile = std::filesystem::path(settings.builddir) / cleanUp(sourceDir) / targetFile().stem();
@@ -90,12 +88,7 @@ int TaskSO::runInner()
for(const auto& task : getDependsTasks())
{
- args.push_back(task->target());
- }
-
- for(const auto& depFile : depFiles)
- {
- args.push_back(depFile.string());
+ args.push_back(task->targetFile().string());
}
for(const auto& flag : config.flags.ldflags)