Add libdirs as rpaths

This commit is contained in:
Thraix
2019-01-09 22:17:51 +01:00
parent ab3f4dfaaa
commit 4e2785bb26
3 changed files with 16 additions and 11 deletions
+3 -2
View File
@@ -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 # 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++
@@ -9,6 +9,7 @@ INCLUDES=
OBJECTS=$(OBJPATH)/ConfigFile.o $(OBJPATH)/IncludeDeps.o $(OBJPATH)/Makefile.o $(OBJPATH)/main.o OBJECTS=$(OBJPATH)/ConfigFile.o $(OBJPATH)/IncludeDeps.o $(OBJPATH)/Makefile.o $(OBJPATH)/main.o
CFLAGS=$(INCLUDES) -std=c++17 -c -w -g3 -D_DEBUG CFLAGS=$(INCLUDES) -std=c++17 -c -w -g3 -D_DEBUG
LIBDIR= LIBDIR=
LDFLAGS=
LIBS=$(LIBDIR) LIBS=$(LIBDIR)
OUTPUT=$(BIN)makegen OUTPUT=$(BIN)makegen
all: $(OUTPUT) all: $(OUTPUT)
@@ -18,7 +19,7 @@ clean:
rm -rf $(OBJPATH)/*.o rm -rf $(OBJPATH)/*.o
$(OUTPUT): $(OBJECTS) $(OUTPUT): $(OBJECTS)
$(info Generating output file) $(info Generating output file)
$(CO) $(OUTPUT) $(OBJECTS) $(LIBS) $(CO) $(OUTPUT) $(OBJECTS) $(LDFLAGS) $(LIBS)
install: all install: all
$(info Installing MakeGen to /usr/bin/) $(info Installing MakeGen to /usr/bin/)
@cp $(OUTPUT) /usr/bin/makegen @cp $(OUTPUT) /usr/bin/makegen
+1 -1
View File
@@ -12,7 +12,7 @@
// Release , should be backwards compatible with any minor version // Release , should be backwards compatible with any minor version
#define MAKEGEN_VERSION_RELEASE 0 #define MAKEGEN_VERSION_RELEASE 0
// Minor changes, should be compatible with any other minor version with same major and release. // 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)) #define MAKEGEN_VERSION ("v" STR(MAKEGEN_VERSION_MAJOR) "." STR(MAKEGEN_VERSION_RELEASE) "." STR(MAKEGEN_VERSION_MINOR))
const static unsigned int FLAG_HELP = BIT(0); const static unsigned int FLAG_HELP = BIT(0);
+12 -8
View File
@@ -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 << "# 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 << "# 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 << "# https://github.com/Thraix/MakeGen" << std::endl;
outputFile << "CC=@g++ $(CFLAGS)" << std::endl; outputFile << "CC=@g++" << std::endl;
if(!conf.executable) if(!conf.executable)
{ {
if(conf.shared) if(conf.shared)
@@ -53,12 +53,6 @@ void Makefile::Save(const ConfigFile& conf)
} }
else else
outputFile << "CO=@g++ -o" << std::endl; 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 << "BIN=" << conf.outputdir << std::endl;
outputFile << "OBJPATH=$(BIN)intermediates" << std::endl; outputFile << "OBJPATH=$(BIN)intermediates" << std::endl;
@@ -88,6 +82,10 @@ void Makefile::Save(const ConfigFile& conf)
{ {
outputFile << "-D" << *it << " "; outputFile << "-D" << *it << " ";
} }
for(auto it = conf.flags.begin();it!=conf.flags.end();++it)
{
outputFile << *it << " ";
}
outputFile << std::endl; outputFile << std::endl;
if(conf.executable) if(conf.executable)
{ {
@@ -97,6 +95,12 @@ void Makefile::Save(const ConfigFile& conf)
outputFile << "-L./" << *it << " "; outputFile << "-L./" << *it << " ";
} }
outputFile << std::endl; 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) "; outputFile << "LIBS=$(LIBDIR) ";
for(auto it = conf.libs.begin();it!=conf.libs.end();++it) 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 << "$(OUTPUT): $(OBJECTS)" << std::endl;
outputFile << "\t$(info Generating output file)" << std::endl; outputFile << "\t$(info Generating output file)" << std::endl;
if(conf.executable) if(conf.executable)
outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS) $(LIBS)" << std::endl; outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS) $(LDFLAGS) $(LIBS)" << std::endl;
else else
outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS)" << std::endl; outputFile << "\t$(CO) $(OUTPUT) $(OBJECTS)" << std::endl;
outputFile << "install: all" << std::endl; outputFile << "install: all" << std::endl;