diff --git a/Makefile b/Makefile index 06b392c..4d97070 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# This Makefile was generated using MakeGen v1.0.6 made by Tim Håkansson +# This Makefile was generated using MakeGen v1.0.8 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++ @@ -9,6 +9,7 @@ INCLUDES= OBJECTS=$(OBJPATH)/ConfigFile.o $(OBJPATH)/IncludeDeps.o $(OBJPATH)/Makefile.o $(OBJPATH)/main.o CFLAGS=$(INCLUDES) -std=c++17 -c -w -g3 -D_DEBUG LIBDIR= +LDFLAGS= LIBS=$(LIBDIR) OUTPUT=$(BIN)makegen all: $(OUTPUT) @@ -18,7 +19,7 @@ clean: rm -rf $(OBJPATH)/*.o $(OUTPUT): $(OBJECTS) $(info Generating output file) - $(CO) $(OUTPUT) $(OBJECTS) $(LIBS) + $(CO) $(OUTPUT) $(OBJECTS) $(LDFLAGS) $(LIBS) install: all $(info Installing MakeGen to /usr/bin/) @cp $(OUTPUT) /usr/bin/makegen diff --git a/src/Common.h b/src/Common.h index 447511b..9a6112c 100755 --- a/src/Common.h +++ b/src/Common.h @@ -12,7 +12,7 @@ // Release , should be backwards compatible with any minor version #define MAKEGEN_VERSION_RELEASE 0 // Minor changes, should be compatible with any other minor version with same major and release. -#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)) const static unsigned int FLAG_HELP = BIT(0); diff --git a/src/Makefile.cpp b/src/Makefile.cpp index 8241f5c..86dbcb7 100755 --- a/src/Makefile.cpp +++ b/src/Makefile.cpp @@ -43,7 +43,7 @@ void Makefile::Save(const ConfigFile& conf) outputFile << "# This Makefile was generated using MakeGen "<< MAKEGEN_VERSION<< " made by Tim Håkansson" << std::endl; outputFile << "# and is licensed under MIT. Full source of the project can be found at" << std::endl; outputFile << "# https://github.com/Thraix/MakeGen" << std::endl; - outputFile << "CC=@g++ $(CFLAGS)" << std::endl; + outputFile << "CC=@g++" << std::endl; if(!conf.executable) { if(conf.shared) @@ -53,12 +53,6 @@ void Makefile::Save(const ConfigFile& conf) } else outputFile << "CO=@g++ -o" << std::endl; - outputFile << "CFLAGS="; - for(auto it = conf.flags.begin();it!=conf.flags.end();++it) - { - outputFile << *it << " "; - } - outputFile << std::endl; outputFile << "BIN=" << conf.outputdir << std::endl; outputFile << "OBJPATH=$(BIN)intermediates" << std::endl; @@ -88,6 +82,10 @@ void Makefile::Save(const ConfigFile& conf) { outputFile << "-D" << *it << " "; } + for(auto it = conf.flags.begin();it!=conf.flags.end();++it) + { + outputFile << *it << " "; + } outputFile << std::endl; if(conf.executable) { @@ -97,6 +95,12 @@ void Makefile::Save(const ConfigFile& conf) outputFile << "-L./" << *it << " "; } outputFile << std::endl; + outputFile << "LDFLAGS="; + for(auto it = conf.libdirs.begin();it!=conf.libdirs.end();++it) + { + outputFile << "-Wl,-rpath=" << *it << " "; + } + outputFile << std::endl; outputFile << "LIBS=$(LIBDIR) "; for(auto it = conf.libs.begin();it!=conf.libs.end();++it) { @@ -116,7 +120,7 @@ void Makefile::Save(const ConfigFile& conf) outputFile << "$(OUTPUT): $(OBJECTS)" << std::endl; outputFile << "\t$(info Generating output file)" << std::endl; if(conf.executable) - outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS) $(LIBS)" << std::endl; + outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS) $(LDFLAGS) $(LIBS)" << std::endl; else outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS)" << std::endl; outputFile << "install: all" << std::endl;