Fix simple flag and excludesource

- Fix simple flag not generating the correct Makefile
- Fix excludesource not excluding the correct files
This commit is contained in:
Thraix
2025-06-04 22:05:37 +02:00
parent d3c334dc79
commit aa0b390379
5 changed files with 19 additions and 12 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
# This Makefile was generated using MakeGen v1.3.3 made by Tim Håkansson
# This Makefile was generated using MakeGen v1.3.4 made by Tim Håkansson
# and is licensed under MIT. Full source of the project can be found at
# https://github.com/Thraix/MakeGen
CC=@g++
+1 -1
View File
@@ -19,5 +19,5 @@
<srcdir>src/</srcdir>
</configuration>
<target>Release</target>
<version>v1.3.3</version>
<version>v1.3.4</version>
</makegen>
+1 -1
View File
@@ -14,7 +14,7 @@
// Release, should be backwards compatible with any minor version
#define MAKEGEN_VERSION_RELEASE 3
// Minor changes, generally bug fixes
#define MAKEGEN_VERSION_MINOR 3
#define MAKEGEN_VERSION_MINOR 4
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
+9 -2
View File
@@ -170,13 +170,20 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
auto itD = dependencies.find(*it);
if(itD == dependencies.end())
{
IncludeDeps* deps = new IncludeDeps(*it, hFiles, dependencies);
size_t extensionPos = it->find_last_of(".");
size_t slash = it->find_last_of("/")+1;
std::string oFile = it->substr(slash, extensionPos - slash)+".o ";
outputFile << "$(OBJPATH)/" << oFile << ":";
deps->Output(outputFile, conf);
if (flags & FLAG_SIMPLE)
{
outputFile << " " << *it;
}
else
{
IncludeDeps* deps = new IncludeDeps(*it, hFiles, dependencies);
deps->Output(outputFile, conf);
}
outputFile << std::endl;
outputFile << "\t$(info -[" << (int)(i / (float)cppFiles.size() * 100) << "%]- $<)" << std::endl;
outputFile << "\t$(CC) $(CFLAGS) -o $@ $<" << std::endl;
+7 -7
View File
@@ -65,16 +65,15 @@ void Utils::GetCppFiles(ConfigFile& conf, std::set<std::string>& cppFiles)
LOG_WARNING("Source file doesn't exist: ", sourceFile);
}
for(auto it = files.begin(); it!=files.end();++it)
for(auto& filename : files)
{
std::string filename = it->substr(path.length());
std::filesystem::path filepath = std::filesystem::relative(filename, "./");
if(IsSourceFile(filename))
{
std::string sourceFile = conf.GetSettingString(ConfigSetting::SourceDir) + filename;
auto it = std::find(excludeSources.begin(), excludeSources.end(), sourceFile);
auto it = std::find(excludeSources.begin(), excludeSources.end(), filename);
if(it == excludeSources.end())
{
cppFiles.emplace(filename);
cppFiles.emplace(filepath.string());
}
}
}
@@ -101,10 +100,11 @@ void Utils::GetCppAndHFiles(ConfigFile& conf, std::set<HFile>& hFiles, std::set<
{
if(IsSourceFile(filename))
{
auto it = std::find(excludeSources.begin(), excludeSources.end(), filename);
std::filesystem::path filepath = std::filesystem::relative(filename, "./");
auto it = std::find(excludeSources.begin(), excludeSources.end(), filepath.string());
if(it == excludeSources.end())
{
cppFiles.emplace(filename);
cppFiles.emplace(filepath.string());
}
}
else if(IsHeaderFile(filename))