diff options
| -rw-r--r-- | libcppbuild.cc | 5 | ||||
| -rw-r--r-- | task.cc | 12 | ||||
| -rw-r--r-- | task.h | 2 | ||||
| -rw-r--r-- | task_ar.cc | 13 | ||||
| -rw-r--r-- | task_ld.cc | 13 | ||||
| -rw-r--r-- | task_so.cc | 13 | 
6 files changed, 52 insertions, 6 deletions
| diff --git a/libcppbuild.cc b/libcppbuild.cc index f575a52..9fcc4d4 100644 --- a/libcppbuild.cc +++ b/libcppbuild.cc @@ -248,7 +248,10 @@ int main(int argc, char* argv[])  	for(auto task : tasks)  	{ -		task->registerDepTasks(tasks); +		if(task->registerDepTasks(tasks)) +		{ +			return 1; +		}  	}  	std::list<std::shared_ptr<Task>> dirtyTasks; @@ -8,18 +8,28 @@ Task::Task(const std::vector<std::string>& depends)  {  } -void Task::registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks) +int Task::registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks)  {  	for(auto const& depStr : dependsStr)  	{ +		bool found{false};  		for(const auto& task : tasks)  		{  			if(task->target() == depStr)  			{  				dependsTasks.push_back(task); +				found = true;  			}  		} +		if(!found) +		{ +			std::cerr << "Could not find dependency " << depStr << " needed by " << +				target() << " target\n"; +			return 1; +		}  	} + +	return 0;  }  bool Task::dirty() @@ -21,7 +21,7 @@ class Task  public:  	Task(const std::vector<std::string>& depends); -	void registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks); +	int registerDepTasks(const std::list<std::shared_ptr<Task>>& tasks);  	bool dirty();  	bool ready(); @@ -178,11 +178,22 @@ std::string TaskAR::flagsString() const  	std::string flagsStr;  	for(const auto& flag : config.ldflags)  	{ -		if(!flagsStr.empty()) +		if(flag != config.ldflags[0])  		{  			flagsStr += " ";  		}  		flagsStr += flag;  	} +	flagsStr += "\n"; + +	for(const auto& dep : config.depends) +	{ +		if(dep != config.depends[0]) +		{ +			flagsStr += " "; +		} +		flagsStr += dep; +	} +  	return flagsStr;  } @@ -192,11 +192,22 @@ std::string TaskLD::flagsString() const  	std::string flagsStr;  	for(const auto& flag : config.ldflags)  	{ -		if(!flagsStr.empty()) +		if(flag != config.ldflags[0])  		{  			flagsStr += " ";  		}  		flagsStr += flag;  	} +	flagsStr += "\n"; + +	for(const auto& dep : config.depends) +	{ +		if(dep != config.depends[0]) +		{ +			flagsStr += " "; +		} +		flagsStr += dep; +	} +  	return flagsStr;  } @@ -188,11 +188,22 @@ std::string TaskSO::flagsString() const  	std::string flagsStr;  	for(const auto& flag : config.ldflags)  	{ -		if(!flagsStr.empty()) +		if(flag != config.ldflags[0])  		{  			flagsStr += " ";  		}  		flagsStr += flag;  	} +	flagsStr += "\n"; + +	for(const auto& dep : config.depends) +	{ +		if(dep != config.depends[0]) +		{ +			flagsStr += " "; +		} +		flagsStr += dep; +	} +  	return flagsStr;  } | 
