summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap.cc2
-rw-r--r--src/configure.cc2
-rw-r--r--src/tasks.cc55
-rw-r--r--src/tasks.h6
4 files changed, 36 insertions, 29 deletions
diff --git a/src/bootstrap.cc b/src/bootstrap.cc
index 0846907..08f7b1f 100644
--- a/src/bootstrap.cc
+++ b/src/bootstrap.cc
@@ -53,7 +53,7 @@ int main(int argc, char* argv[])
settings.parallel_processes =
std::max(1u, std::thread::hardware_concurrency() * 2 - 1);
settings.verbose = 0;
- auto all_tasks = getTasks(settings);
+ auto all_tasks = getTasks(settings, {}, false);
for(auto task : all_tasks)
{
if(task->registerDepTasks(all_tasks))
diff --git a/src/configure.cc b/src/configure.cc
index cc963f8..37bd3cf 100644
--- a/src/configure.cc
+++ b/src/configure.cc
@@ -265,7 +265,7 @@ int regenerateCache(const Settings& default_settings,
host_arch = build_arch;
}
- auto tasks = getTasks(settings);
+ auto tasks = getTasks(settings, {}, false);
/*
bool needs_cpp{false};
bool needs_c{false};
diff --git a/src/tasks.cc b/src/tasks.cc
index 3bfff8b..8ab296f 100644
--- a/src/tasks.cc
+++ b/src/tasks.cc
@@ -18,7 +18,8 @@
#include "rebuild.h"
#include "configure.h"
-const std::deque<Target>& getTargets(const Settings& settings)
+const std::deque<Target>& getTargets(const Settings& settings,
+ bool resolve_externals)
{
static bool initialised{false};
static std::deque<Target> targets;
@@ -36,31 +37,34 @@ const std::deque<Target>& getTargets(const Settings& settings)
auto configs = configFiles[i].cb();
for(auto& config : configs)
{
- // Resolv config externals
- for(const auto& external : config.externals)
+ if(resolve_externals)
{
- if(externals.find(external) == externals.end())
+ // Resolv config externals
+ for(const auto& external : config.externals)
{
- std::cout << "External '" << external <<
- "' not found cache - run configure.\n";
- continue;
+ if(externals.find(external) == externals.end())
+ {
+ std::cout << "External '" << external <<
+ "' not found in cache - run configure.\n";
+ exit(1);
+ }
+ const auto& flags = externals.at(external);
+ config.flags.cflags.insert(config.flags.cflags.end(),
+ flags.cflags.begin(),
+ flags.cflags.end());
+ config.flags.cxxflags.insert(config.flags.cxxflags.end(),
+ flags.cxxflags.begin(),
+ flags.cxxflags.end());
+ config.flags.ldflags.insert(config.flags.ldflags.end(),
+ flags.ldflags.begin(),
+ flags.ldflags.end());
+ config.flags.asmflags.insert(config.flags.asmflags.end(),
+ flags.asmflags.begin(),
+ flags.asmflags.end());
+ //config.libs.insert(config.libs.end(),
+ // libs.begin(),
+ // libs.end());
}
- const auto& flags = externals.at(external);
- config.flags.cflags.insert(config.flags.cflags.end(),
- flags.cflags.begin(),
- flags.cflags.end());
- config.flags.cxxflags.insert(config.flags.cxxflags.end(),
- flags.cxxflags.begin(),
- flags.cxxflags.end());
- config.flags.ldflags.insert(config.flags.ldflags.end(),
- flags.ldflags.begin(),
- flags.ldflags.end());
- config.flags.asmflags.insert(config.flags.asmflags.end(),
- flags.asmflags.begin(),
- flags.asmflags.end());
- //config.libs.insert(config.libs.end(),
- // libs.begin(),
- // libs.end());
}
targets.push_back({config, path});
@@ -169,9 +173,10 @@ std::shared_ptr<Task> getNextTask(const std::list<std::shared_ptr<Task>>& allTas
}
std::list<std::shared_ptr<Task>> getTasks(const Settings& settings,
- const std::vector<std::string> names)
+ const std::vector<std::string> names,
+ bool resolve_externals)
{
- auto& targets = getTargets(settings);
+ auto& targets = getTargets(settings, resolve_externals);
std::list<std::shared_ptr<Task>> tasks;
for(const auto& target : targets)
{
diff --git a/src/tasks.h b/src/tasks.h
index aaa3510..f2a77d4 100644
--- a/src/tasks.h
+++ b/src/tasks.h
@@ -20,7 +20,8 @@ struct Target
};
//! Get list of all registered targets
-const std::deque<Target>& getTargets(const Settings& settings);
+const std::deque<Target>& getTargets(const Settings& settings,
+ bool resolve_externals = true);
//! Returns next dirty task from the dirtyTasks list that has all its dependencies
//! fulfilled.
@@ -32,7 +33,8 @@ std::shared_ptr<Task> getNextTask(const std::list<std::shared_ptr<Task>>& allTas
//! Get list of tasks filtered by name including each of their direct
//! dependency tasks (ie. objects tasks from their sources).
std::list<std::shared_ptr<Task>> getTasks(const Settings& settings,
- const std::vector<std::string> names = {});
+ const std::vector<std::string> names = {},
+ bool resolve_externals = true);
//! Generate list of targets from a single configuration, including the final
//! link target and all its objects files (if any).