diff options
Diffstat (limited to 'src/build.cc')
-rw-r--r-- | src/build.cc | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/build.cc b/src/build.cc index 445979e..4cec3b9 100644 --- a/src/build.cc +++ b/src/build.cc @@ -7,8 +7,6 @@ #include <set> #include <thread> -#include "tasks.h" - using namespace std::chrono_literals; int build(const Settings& settings, @@ -171,3 +169,39 @@ int build(const Settings& settings, return 0; } + +int build(const Settings& settings, + const std::string& name, + const std::vector<Target>& targets, + const std::list<std::shared_ptr<Task>>& all_tasks) +{ + bool task_found{false}; + std::list<std::shared_ptr<Task>> ts; + + for(const auto& target : targets) + { + for(auto task : all_tasks) + { + if(task->name() == target.config.target || + task->target() == target.config.target) + { + std::cout << target.config.target << "\n"; + task_found = true; + + auto depSet = getDepTasks(task); + for(const auto& task : depSet) + { + ts.push_back(task); + } + } + } + } + + if(!task_found) + { + std::cerr << "*** No rule to make target '" << name << "'. Stop.\n"; + return 1; + } + + return build(settings, name, ts, all_tasks); +} |