summaryrefslogtreecommitdiff
path: root/src/tasks.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/tasks.cc')
-rw-r--r--src/tasks.cc33
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: