Fix relative paths being put in the wrong intermediate directory
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# This Makefile was generated using MakeGen v1.3.7 made by Tim Håkansson
|
# This Makefile was generated using MakeGen v1.3.8 made by Tim Håkansson
|
||||||
# and is licensed under MIT. Full source of the project can be found at
|
# and is licensed under MIT. Full source of the project can be found at
|
||||||
# https://github.com/Thraix/MakeGen
|
# https://github.com/Thraix/MakeGen
|
||||||
CC=@g++
|
CC=@g++
|
||||||
|
|||||||
+1
-1
@@ -19,5 +19,5 @@
|
|||||||
<srcdir>src/</srcdir>
|
<srcdir>src/</srcdir>
|
||||||
</configuration>
|
</configuration>
|
||||||
<target>Release</target>
|
<target>Release</target>
|
||||||
<version>v1.3.7</version>
|
<version>v1.3.8</version>
|
||||||
</makegen>
|
</makegen>
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
// Release, should be backwards compatible with any minor version
|
// Release, should be backwards compatible with any minor version
|
||||||
#define MAKEGEN_VERSION_RELEASE 3
|
#define MAKEGEN_VERSION_RELEASE 3
|
||||||
// Minor changes, generally bug fixes
|
// Minor changes, generally bug fixes
|
||||||
#define MAKEGEN_VERSION_MINOR 7
|
#define MAKEGEN_VERSION_MINOR 8
|
||||||
|
|
||||||
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -54,7 +54,9 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
|
|||||||
{
|
{
|
||||||
std::filesystem::path cppFile(*it);
|
std::filesystem::path cppFile(*it);
|
||||||
std::filesystem::path oFile = cppFile.replace_extension("o");
|
std::filesystem::path oFile = cppFile.replace_extension("o");
|
||||||
outputFile << "$(OBJPATH)/" << oFile.string() << " ";
|
std::string oFileStr = oFile.string();
|
||||||
|
Utils::Replace(oFileStr, "..", "dotdot");
|
||||||
|
outputFile << "$(OBJPATH)/" << oFileStr << " ";
|
||||||
}
|
}
|
||||||
outputFile << std::endl;
|
outputFile << std::endl;
|
||||||
if (outputtype == "executable" || outputtype != "sharedlibrary")
|
if (outputtype == "executable" || outputtype != "sharedlibrary")
|
||||||
@@ -182,7 +184,9 @@ void Makefile::Save(ConfigFile& conf, unsigned int flags)
|
|||||||
{
|
{
|
||||||
std::filesystem::path cppFile(*it);
|
std::filesystem::path cppFile(*it);
|
||||||
std::filesystem::path oFile = cppFile.replace_extension("o");
|
std::filesystem::path oFile = cppFile.replace_extension("o");
|
||||||
outputFile << "$(OBJPATH)/" << oFile.string() << ":";
|
std::string oFileStr = oFile.string();
|
||||||
|
Utils::Replace(oFileStr, "..", "dotdot");
|
||||||
|
outputFile << "$(OBJPATH)/" << oFileStr << ":";
|
||||||
if (flags & FLAG_SIMPLE)
|
if (flags & FLAG_SIMPLE)
|
||||||
{
|
{
|
||||||
outputFile << " " << *it;
|
outputFile << " " << *it;
|
||||||
@@ -206,7 +210,9 @@ std::set<std::string> Makefile::GetIntermediateDirectories(const std::set<std::s
|
|||||||
{
|
{
|
||||||
std::filesystem::path cppPath{cppFile};
|
std::filesystem::path cppPath{cppFile};
|
||||||
std::filesystem::path oFile = cppPath.replace_extension("o");
|
std::filesystem::path oFile = cppPath.replace_extension("o");
|
||||||
intermediateDirectories.emplace("$(OBJPATH)/" + oFile.parent_path().string());
|
std::string parentPathStr = oFile.parent_path().string();
|
||||||
|
Utils::Replace(parentPathStr, "..", "dotdot");
|
||||||
|
intermediateDirectories.emplace("$(OBJPATH)/" + parentPathStr);
|
||||||
}
|
}
|
||||||
return intermediateDirectories;
|
return intermediateDirectories;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,19 @@ bool Utils::StartsWith(const std::string& str, const std::string& prefix)
|
|||||||
return str.compare(0, prefix.size(), prefix) == 0;
|
return str.compare(0, prefix.size(), prefix) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Utils::Replace(std::string& str, const std::string& from, const std::string& to)
|
||||||
|
{
|
||||||
|
if (from.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
size_t pos = str.find(from, 0);
|
||||||
|
while (pos != std::string::npos)
|
||||||
|
{
|
||||||
|
str.replace(pos, from.length(), to);
|
||||||
|
pos = str.find(from, pos + to.length());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string Utils::CommonPrefix(const std::string& s1, const std::string& s2)
|
std::string Utils::CommonPrefix(const std::string& s1, const std::string& s2)
|
||||||
{
|
{
|
||||||
size_t n = 0;
|
size_t n = 0;
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ struct Utils
|
|||||||
static bool IsHeaderFile(const std::string& filepath);
|
static bool IsHeaderFile(const std::string& filepath);
|
||||||
|
|
||||||
static std::string CommonPrefix(const std::string& s1, const std::string& s2);
|
static std::string CommonPrefix(const std::string& s1, const std::string& s2);
|
||||||
|
|
||||||
static bool StartsWith(const std::string& str, const std::string& prefix);
|
static bool StartsWith(const std::string& str, const std::string& prefix);
|
||||||
|
static void Replace(std::string& str, const std::string& from, const std::string& to);
|
||||||
static void GetCppFiles(ConfigFile& conf, std::set<std::string>& cppFiles);
|
static void GetCppFiles(ConfigFile& conf, std::set<std::string>& cppFiles);
|
||||||
static void GetCppAndHFiles(ConfigFile& conf, std::set<HFile>& hFiles, std::set<std::string>& cppFiles);
|
static void GetCppAndHFiles(ConfigFile& conf, std::set<HFile>& hFiles, std::set<std::string>& cppFiles);
|
||||||
static void GetHFiles(const std::string& dependencyDir, ConfigFile& conf, std::set<HFile>& hFiles);
|
static void GetHFiles(const std::string& dependencyDir, ConfigFile& conf, std::set<HFile>& hFiles);
|
||||||
|
|||||||
Reference in New Issue
Block a user