From 3c6e5ff32fd24acf5e1deb62860ddd7b864066b3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 26 Aug 2021 20:46:23 +0200 Subject: Prepend target name to object files. --- task_cc.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/task_cc.cc b/task_cc.cc index a5fd9f0..366cbfe 100644 --- a/task_cc.cc +++ b/task_cc.cc @@ -93,13 +93,25 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings, sourceFile = sourceDir; sourceFile /= source; - targetFile = settings.builddir / sourceFile.stem(); - targetFile += ".o"; + std::filesystem::path base = settings.builddir; + base /= config.target; + base += "-"; + base += sourceFile.stem(); - depsFile = settings.builddir / sourceFile.stem(); - depsFile += ".d"; + if(sourceFile.extension().string() == ".c") + { + base += "_c"; + } + else + { + base += "_cc"; + } - flagsFile = settings.builddir / sourceFile.stem(); + targetFile = base; + targetFile += ".o"; + depsFile = base; + depsFile += ".d"; + flagsFile = base; flagsFile += ".flags"; target_type = TargetType::Object; -- cgit v1.2.3