summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/task_ar.cc14
-rw-r--r--src/task_ld.cc20
-rw-r--r--src/task_so.cc14
3 files changed, 7 insertions, 41 deletions
diff --git a/src/task_ar.cc b/src/task_ar.cc
index 0763c04..086ffa1 100644
--- a/src/task_ar.cc
+++ b/src/task_ar.cc
@@ -81,22 +81,12 @@ bool TaskAR::dirtyInner()
int TaskAR::runInner()
{
- std::string objectlist;
- for(const auto& objectFile : objectFiles)
- {
- if(!objectlist.empty())
- {
- objectlist += " ";
- }
- objectlist += objectFile.string();
- }
-
std::vector<std::string> args;
args.push_back("rcs");
args.push_back(targetFile.string());
- for(const auto& objectFile : objectFiles)
+ for(const auto& task : getDependsTasks())
{
- args.push_back(objectFile.string());
+ args.push_back(task->target());
}
{ // Write flags to file.
diff --git a/src/task_ld.cc b/src/task_ld.cc
index 918fdee..600de8e 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -100,31 +100,17 @@ bool TaskLD::dirtyInner()
int TaskLD::runInner()
{
- std::string objectlist;
- for(const auto& objectFile : objectFiles)
- {
- if(!objectlist.empty())
- {
- objectlist += " ";
- }
- objectlist += objectFile.string();
- }
-
std::vector<std::string> args;
- for(const auto& objectFile : objectFiles)
- {
- args.push_back(objectFile.string());
- }
-
- for(const auto& depFile : depFiles)
+ for(const auto& dep : getDependsTasks())
{
+ std::filesystem::path depFile = dep->target();
if(depFile.extension() == ".so")
{
args.push_back(std::string("-L") + settings.builddir);
auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix
args.push_back(std::string("-l") + lib);
}
- else if(depFile.extension() == ".a")
+ else if(depFile.extension() == ".a" || depFile.extension() == ".o")
{
args.push_back(depFile.string());
}
diff --git a/src/task_so.cc b/src/task_so.cc
index 430c3e1..44340dd 100644
--- a/src/task_so.cc
+++ b/src/task_so.cc
@@ -81,16 +81,6 @@ bool TaskSO::dirtyInner()
int TaskSO::runInner()
{
- std::string objectlist;
- for(const auto& objectFile : objectFiles)
- {
- if(!objectlist.empty())
- {
- objectlist += " ";
- }
- objectlist += objectFile.string();
- }
-
std::vector<std::string> args;
args.push_back("-fPIC");
@@ -99,9 +89,9 @@ int TaskSO::runInner()
args.push_back("-o");
args.push_back(targetFile.string());
- for(const auto& objectFile : objectFiles)
+ for(const auto& task : getDependsTasks())
{
- args.push_back(objectFile.string());
+ args.push_back(task->target());
}
for(const auto& depFile : depFiles)