diff --git a/Makefile b/Makefile
index 1962240..81c481e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-# This Makefile was generated using MakeGen v1.3.2 made by Tim HÃ¥kansson
+# This Makefile was generated using MakeGen v1.3.3 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 1ccd807..6585d0a 100644
--- a/makegen.xml
+++ b/makegen.xml
@@ -19,5 +19,5 @@
src/
Release
- v1.3.2
+ v1.3.3
diff --git a/src/Common.h b/src/Common.h
index 184c7f7..e56c775 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 2
+#define MAKEGEN_VERSION_MINOR 3
#define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
diff --git a/src/IncludeDeps.cpp b/src/IncludeDeps.cpp
index ec8eb86..bd3485a 100755
--- a/src/IncludeDeps.cpp
+++ b/src/IncludeDeps.cpp
@@ -29,8 +29,13 @@ IncludeDeps::IncludeDeps(const std::string& filename, bool projectHFile, const s
{
std::string include = GetIncludeFile(line);
+ std::filesystem::path includeFileRelativeToSource;
+ if (path.is_absolute())
+ includeFileRelativeToSource = std::filesystem::relative("/", ".").string() + "/" + include;
+ else
+ includeFileRelativeToSource = std::filesystem::relative(path.parent_path(), ".").string() + "/" + include;
+
// Check if file can be found relative to current file:
- std::filesystem::path includeFileRelativeToSource = std::filesystem::relative(path.parent_path(), ".").string() + "/" + include;
if (FileUtils::FileExists(includeFileRelativeToSource.string()))
{
auto itD = allDeps.find(includeFileRelativeToSource.string());
diff --git a/src/IncludeDeps.h b/src/IncludeDeps.h
index e257161..82e3567 100755
--- a/src/IncludeDeps.h
+++ b/src/IncludeDeps.h
@@ -15,7 +15,7 @@ class IncludeDeps
{
public:
std::map dependencies;
- std::string filepath;
+ std::filesystem::path filepath;
bool projectHFile;
static std::set printSet;
static int printCounter;
@@ -28,14 +28,18 @@ class IncludeDeps
std::ostream& Output(std::ostream& stream, const ConfigFile& conf)
{
- std::string filePathRelativeToConfig = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath, "./").string();
- if(printSet.find(filePathRelativeToConfig) != printSet.end())
+ std::string filePathInMakeFile = filepath;
+ if(!filepath.is_absolute())
+ filePathInMakeFile = std::filesystem::relative(conf.GetConfigPath() + "/" + filepath.string(), "./").string();
+
+ if(printSet.find(filePathInMakeFile) != printSet.end())
return stream;
- printSet.emplace(filePathRelativeToConfig);
+ printSet.emplace(filePathInMakeFile);
printCounter++;
+
if(!projectHFile)
{
- stream << " " << filePathRelativeToConfig;
+ stream << " " << filePathInMakeFile;
}
for(auto it = dependencies.begin(); it != dependencies.end(); ++it)
{
diff --git a/src/Utils.h b/src/Utils.h
index bb9b04b..b051f82 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -1,8 +1,9 @@
#pragma once
+#include
+#include
#include
#include
-#include
struct HFile
@@ -10,7 +11,7 @@ struct HFile
std::string filename;
bool isProjectHFile;
- std::string filepath;
+ std::filesystem::path filepath;
HFile(const std::string& filename, const std::string& directory, bool isProjectHFile)
: filename{filename}, isProjectHFile{isProjectHFile}, filepath{directory+filename}
@@ -20,6 +21,11 @@ struct HFile
{
return h1.filename < h2.filename;
}
+
+ friend std::ostream& operator<<(std::ostream& ostream, const HFile& hFile)
+ {
+ return ostream << "filename: " << hFile.filename << "\tfilepath: " << hFile.filepath.string();
+ }
};
class ConfigFile;