Add support for specifying target for dependencies

- Use <dependency target="target"> to specify which target the dependency
should be compiled for.
- Fix binary not being removed when doing makegen clean
This commit is contained in:
Thraix
2026-05-08 19:09:00 +02:00
parent c0d6afbf1a
commit 5d00ada431
10 changed files with 87 additions and 32 deletions
+5 -5
View File
@@ -105,13 +105,13 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
outputFile << "-l" << *it << " ";
}
outputFile << std::endl;
std::vector<std::string>& dependencies = conf.GetSettingVectorString(ConfigSetting::Dependency);
const std::vector<Dependency>& dependencies = conf.GetDependencies();
if (!dependencies.empty())
{
outputFile << "DEPENDENCIES=";
for (auto it = dependencies.begin(); it != dependencies.end(); ++it)
for (const auto& [path, target] : dependencies)
{
outputFile << *it << " ";
outputFile << path << " ";
}
outputFile << std::endl;
}
@@ -157,8 +157,8 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
// Clean
outputFile << "clean:" << std::endl;
outputFile << "\t$(info Removing $(OBJPATH))" << std::endl;
outputFile << "\t@rm -rf $(OBJPATH)/" << std::endl;
outputFile << "\t$(info Removing $(OBJPATH) and $(OUTPUT))" << std::endl;
outputFile << "\t@rm -rf $(OBJPATH)/ $(OUTPUT)" << std::endl;
// Output file
outputFile << "$(OUTPUT): $(OBJECTS)" << std::endl;