diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-06-08 17:38:01 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2022-06-09 22:28:32 +0200 |
commit | 7a16146600384272baf7fb2fc0fc64f59b17ffe9 (patch) | |
tree | 755df6191525a49862d957dc120dcbabcbb03f39 /src/tasks.cc | |
parent | 69d6df33bf7fabe62cdcd61bcd7ebc20b6de6b67 (diff) |
Function target type including support for generated sources.
Diffstat (limited to 'src/tasks.cc')
-rw-r--r-- | src/tasks.cc | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/src/tasks.cc b/src/tasks.cc index 646292a..68b2476 100644 --- a/src/tasks.cc +++ b/src/tasks.cc @@ -15,6 +15,7 @@ #include "task_ld.h" #include "task_ar.h" #include "task_so.h" +#include "task_fn.h" #include "rebuild.h" #include "configure.h" @@ -80,12 +81,18 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, const Settings& settings, const std::string& sourceDir) { + std::set<std::shared_ptr<Task>> tasks; + std::filesystem::path targetFile(config.target); TargetType target_type{config.type}; if(target_type == TargetType::Auto) { - if(targetFile.extension() == ".a") + if(config.function != nullptr) + { + target_type = TargetType::Function; + } + else if(targetFile.extension() == ".a") { target_type = TargetType::StaticLibrary; } @@ -106,13 +113,26 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, } std::vector<std::string> objects; - std::set<std::shared_ptr<Task>> tasks; - for(const auto& file : config.sources) + if(target_type != TargetType::Function) { - auto task = std::make_shared<TaskCC>(config, settings, sourceDir, file); - tasks.insert(task); - objects.push_back(task->targetFile().string()); + for(const auto& file : config.sources) + { + auto task = std::make_shared<TaskCC>(config, settings, sourceDir, file); + tasks.insert(task); + objects.push_back(task->targetFile().string()); + } } +#ifndef BOOTSTRAP + else + { + for(const auto& file : config.sources) + { + auto task = std::make_shared<TaskFn>(config, settings, sourceDir, file); + tasks.insert(task); + objects.push_back(task->target()); + } + } +#endif switch(target_type) { @@ -144,6 +164,7 @@ std::set<std::shared_ptr<Task>> taskFactory(const BuildConfiguration& config, break; case TargetType::Object: + case TargetType::Function: break; #else default: |