summaryrefslogtreecommitdiff
path: root/src/task_cc.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2021-10-14 22:19:26 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2021-10-14 22:19:26 +0200
commitc0eacf8e85003844b95e71b9004fa464d4586a38 (patch)
treea407dc8ec3830cb01faf3d5153c8741f9b19e1c1 /src/task_cc.cc
parent87aad8c76eb2371720c9aceef7516ecb0859ecdf (diff)
Use dependency system and build system for compiling ctor on config changes.
Diffstat (limited to 'src/task_cc.cc')
-rw-r--r--src/task_cc.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/task_cc.cc b/src/task_cc.cc
index 73297f2..e4bd7aa 100644
--- a/src/task_cc.cc
+++ b/src/task_cc.cc
@@ -12,6 +12,31 @@
#include "execute.h"
#include "util.h"
+namespace
+{
+bool isClean(char c)
+{
+ return c != '.' && c != '/';
+}
+
+std::string cleanUp(const std::string& path)
+{
+ std::string cleaned;
+ for(const auto& c : path)
+ {
+ if(isClean(c))
+ {
+ cleaned += c;
+ }
+ else
+ {
+ cleaned += '_';
+ }
+ }
+ return cleaned;
+}
+}
+
TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
const std::string& sourceDir, const Source& source)
: Task(config)
@@ -26,7 +51,7 @@ TaskCC::TaskCC(const BuildConfiguration& config, const Settings& settings,
base /= sourceFile.parent_path();
std::filesystem::create_directories(base);
- base /= config.target;
+ base /= cleanUp(config.target);
base += "-";
base += sourceFile.stem();