From aa0b390379bb20fb43b8cb1361aa6758c897809a Mon Sep 17 00:00:00 2001 From: Thraix Date: Wed, 4 Jun 2025 22:05:37 +0200 Subject: [PATCH] Fix simple flag and excludesource - Fix simple flag not generating the correct Makefile - Fix excludesource not excluding the correct files --- Makefile | 2 +- makegen.xml | 2 +- src/Common.h | 2 +- src/Makefile.cpp | 11 +++++++++-- src/Utils.cpp | 14 +++++++------- 5 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 81c481e..3cd4996 100644 --- a/Makefile +++ b/Makefile @@ -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++ diff --git a/makegen.xml b/makegen.xml index 6585d0a..08cd2b3 100644 --- a/makegen.xml +++ b/makegen.xml @@ -19,5 +19,5 @@ src/ Release - v1.3.3 + v1.3.4 diff --git a/src/Common.h b/src/Common.h index e56c775..71d3e62 100755 --- a/src/Common.h +++ b/src/Common.h @@ -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)) diff --git a/src/Makefile.cpp b/src/Makefile.cpp index caf1717..85968c9 100755 --- a/src/Makefile.cpp +++ b/src/Makefile.cpp @@ -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; diff --git a/src/Utils.cpp b/src/Utils.cpp index 4a58345..4854340 100644 --- a/src/Utils.cpp +++ b/src/Utils.cpp @@ -65,16 +65,15 @@ void Utils::GetCppFiles(ConfigFile& conf, std::set& 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& 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))