summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-08-26 20:46:23 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-08-26 20:46:23 +0200
commit3c6e5ff32fd24acf5e1deb62860ddd7b864066b3 (patch)
treeb06fa4ff4c3b96f5e1de3a23e1a3c9fe694098c0
parent9c5ba2e3b715fec11219bf9e1f57b2c67f1b7fa9 (diff)
Prepend target name to object files.
-rw-r--r--task_cc.cc22
1 files 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;