diff --git a/samples/Makefile b/samples/Makefile index 3fe0cfd0..9e49b272 100644 --- a/samples/Makefile +++ b/samples/Makefile @@ -1,12 +1,5 @@ -export DEBUGBUILD = no -ifeq ($(DEBUGBUILD), yes) - DEBUGFLAGS = -g -DDEBUG -else - DEBUGFLAGS = -O2 -DNDEBUG -endif - export CC = g++ -export CFLAGS = -W -Wall -ansi -I../../include $(DEBUGFLAGS) +export CFLAGS = -W -Wall -ansi -g -O2 -DNDEBUG -I../../include export LDFLAGS = export EXECPATH = ../bin diff --git a/src/SFML/Audio/Makefile b/src/SFML/Audio/Makefile index 987171d6..713faa25 100644 --- a/src/SFML/Audio/Makefile +++ b/src/SFML/Audio/Makefile @@ -1,23 +1,15 @@ SRC = $(wildcard *.cpp) OBJ = $(SRC:.cpp=.o) -ifeq ($(STATIC), yes) - LIB = libsfml-audio-s.a - LIBNAME = $(LIBPATH)/$(LIB) - INSTALL = -else - LIB = libsfml-audio.so - LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) - INSTALL = && $(LN) $(LNFLAGS) $(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) -endif +LIB = libsfml-audio.so +LIBNAME = $(LIB).$(VERSION) +FULLLIBNAME = $(LIBPATH)/$(LIBNAME) +LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB) all: $(LIB) -libsfml-audio-s.a: $(OBJ) - $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) - -libsfml-audio.so: $(OBJ) $(OBJVORBIS) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lsndfile -lopenal +libsfml-audio.so: $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) -lsndfile -lopenal $(OBJ): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) @@ -28,7 +20,9 @@ clean: @rm -rf $(OBJ) mrproper: clean - @rm -rf $(LIBNAME) + @rm -rf $(FULLLIBNAME) install: - @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) + objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME) + objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME) + $(LINK) diff --git a/src/SFML/Graphics/Makefile b/src/SFML/Graphics/Makefile index fc2c8d55..28becbf2 100644 --- a/src/SFML/Graphics/Makefile +++ b/src/SFML/Graphics/Makefile @@ -11,29 +11,24 @@ OBJPNG = $(SRCPNG:.c=.o) OBJSOIL = $(SRCSOIL:.c=.o) OBJZLIB = $(SRCZLIB:.c=.o) -ifeq ($(STATIC), yes) - LIB = libsfml-graphics-s.a - LIBNAME = $(LIBPATH)/$(LIB) - INSTALL = -else - LIB = libsfml-graphics.so - LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) - INSTALL = && $(LN) $(LNFLAGS) $(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) -endif +LIB = libsfml-graphics.so +LIBNAME = $(LIB).$(VERSION) +FULLLIBNAME = $(LIBPATH)/$(LIBNAME) +LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB) all: $(LIB) -libsfml-graphics-s.a: $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) - $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) - libsfml-graphics.so: $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) -lfreetype -lX11 -lGL + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) -lfreetype -lX11 -lGL $(OBJ): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) -I/usr/include/freetype2 -$(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB): %.o: %.c - $(CC) -o $@ -c $< $(CFLAGSEXT) -DSTBI_FAILURE_USERMSG +$(OBJSOIL): %.o: %.c + $(CC) -o $@ -c $< $(CFLAGSEXT) -DSTBI_FAILURE_USERMSG + +$(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJZLIB): %.o: %.c + $(CC) -o $@ -c $< $(CFLAGSEXT) .PHONY: clean mrproper @@ -41,7 +36,9 @@ clean: @rm -rf $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB) mrproper: clean - @rm -rf $(LIBNAME) + @rm -rf $(FULLLIBNAME) -install: - @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) +install: + objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME) + objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME) + $(LINK) diff --git a/src/SFML/Makefile b/src/SFML/Makefile index 0b885eb5..0338446d 100644 --- a/src/SFML/Makefile +++ b/src/SFML/Makefile @@ -1,35 +1,17 @@ -export DEBUGBUILD = no -export STATIC = no - -ifeq ($(DEBUGBUILD), yes) - DEBUGFLAGS = -g -DDEBUG -else - DEBUGFLAGS = -O2 -DNDEBUG -endif - -ifeq ($(STATIC), no) - BUILDFLAGS = -fPIC - LINKFLAGS = -shared -else - BUILDFLAGS = - LINKFLAGS = -endif - export CC = gcc export CPP = g++ -export CFLAGS = -W -Wall -pedantic -I../../../include -I../../ $(DEBUGFLAGS) $(BUILDFLAGS) -export CFLAGSEXT = -I../../../include -I../.. $(DEBUGFLAGS) $(BUILDFLAGS) -export LDFLAGS = $(LINKFLAGS) +export CFLAGS = -W -Wall -pedantic -g -O2 -DNDEBUG -I../../../include -I../../ -fPIC +export CFLAGSEXT = -I../../../include -I../.. -g -O2 -DNDEBUG -fPIC +export LDFLAGS = -shared export LIBPATH = ../../../lib export VERSION = 2.0 export CP = cp export LN = ln export LNFLAGS = -s -f -export AR = ar -export ARFLAGS = rcs export DESTDIR = /usr/local export DESTLIBDIR = $(DESTDIR)/lib -export DESTINCDIR = $(DESTDIR)/include +export DESTINCDIR = $(DESTDIR)/include +export DESTDBGDIR = $(DESTLIBDIR)/debug/$(DESTLIBDIR) all: sfml-system sfml-window sfml-network sfml-graphics sfml-audio @@ -64,4 +46,5 @@ mrproper: clean install: @(mkdir -p $(DESTLIBDIR)) @(mkdir -p $(DESTINCDIR)) - @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@ && $(CP) -r ../../../include/SFML/ $(DESTINCDIR)/) + @(mkdir -p $(DESTDBGDIR)) + @(cd ./System && $(MAKE) $@ && cd ../Window && $(MAKE) $@ && cd ../Network && $(MAKE) $@ && cd ../Graphics && $(MAKE) $@ && cd ../Audio && $(MAKE) $@ && $(CP) -r ../../../include/SFML/ $(DESTINCDIR)/ && find $(DESTINCDIR)/SFML -name .svn -type d -print0 | xargs -0 /bin/rm -rf) diff --git a/src/SFML/Network/Makefile b/src/SFML/Network/Makefile index 62fb6731..035d38b4 100644 --- a/src/SFML/Network/Makefile +++ b/src/SFML/Network/Makefile @@ -1,23 +1,15 @@ SRC = $(wildcard *.cpp ./Unix/*.cpp) OBJ = $(SRC:.cpp=.o) -ifeq ($(STATIC), yes) - LIB = libsfml-network-s.a - LIBNAME = $(LIBPATH)/$(LIB) - INSTALL = -else - LIB = libsfml-network.so - LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) - INSTALL = && $(LN) $(LNFLAGS) $(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) -endif +LIB = libsfml-network.so +LIBNAME = $(LIB).$(VERSION) +FULLLIBNAME = $(LIBPATH)/$(LIBNAME) +LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB) all: $(LIB) -libsfml-network-s.a: $(OBJ) - $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) - libsfml-network.so: $(OBJ) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) $(OBJ): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) @@ -28,7 +20,9 @@ clean: @rm -rf $(OBJ) mrproper: clean - @rm -rf $(LIBNAME) + @rm -rf $(FULLLIBNAME) install: - @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) + objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME) + objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME) + $(LINK) diff --git a/src/SFML/System/Makefile b/src/SFML/System/Makefile index 1cf6211e..f789ad20 100644 --- a/src/SFML/System/Makefile +++ b/src/SFML/System/Makefile @@ -1,23 +1,15 @@ SRC = $(wildcard *.cpp ./Unix/*.cpp) OBJ = $(SRC:.cpp=.o) -ifeq ($(STATIC), yes) - LIB = libsfml-system-s.a - LIBNAME = $(LIBPATH)/$(LIB) - INSTALL = -else - LIB = libsfml-system.so - LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) - INSTALL = && $(LN) $(LNFLAGS) $(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) -endif +LIB = libsfml-system.so +LIBNAME = $(LIB).$(VERSION) +FULLLIBNAME = $(LIBPATH)/$(LIBNAME) +LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB) all: $(LIB) -libsfml-system-s.a: $(OBJ) - $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) - libsfml-system.so: $(OBJ) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) -lpthread + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) -lpthread $(OBJ): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) @@ -28,7 +20,9 @@ clean: @rm -rf $(OBJ) mrproper: clean - @rm -rf $(LIBNAME) + @rm -rf $(FULLLIBNAME) install: - @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) + objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME) + objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME) + $(LINK) diff --git a/src/SFML/Window/Makefile b/src/SFML/Window/Makefile index 0dd689c4..b5a0be87 100644 --- a/src/SFML/Window/Makefile +++ b/src/SFML/Window/Makefile @@ -1,35 +1,28 @@ -SRC = $(wildcard *.cpp ./Linux/*.cpp) -OBJ = $(SRC:.cpp=.o) -OBJGLEW = $(SRCGLEW:.c=.o) +SRC = $(wildcard *.cpp ./Linux/*.cpp) +OBJ = $(SRC:.cpp=.o) -ifeq ($(STATIC), yes) - LIB = libsfml-window-s.a - LIBNAME = $(LIBPATH)/$(LIB) - INSTALL = -else - LIB = libsfml-window.so - LIBNAME = $(LIBPATH)/$(LIB).$(VERSION) - INSTALL = && $(LN) $(LNFLAGS) $(LIB).$(VERSION) $(DESTLIBDIR)/$(LIB) -endif +LIB = libsfml-window.so +LIBNAME = $(LIB).$(VERSION) +FULLLIBNAME = $(LIBPATH)/$(LIBNAME) +LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB) all: $(LIB) -libsfml-window-s.a: $(OBJ) - $(AR) $(ARFLAGS) $(LIBNAME) $(OBJ) - libsfml-window.so: $(OBJ) - $(CPP) $(LDFLAGS) -Wl,-soname,$(LIB).$(VERSION) -o $(LIBNAME) $(OBJ) $(OBJGLEW) -lX11 -lXrandr -lGL + $(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) -lX11 -lXrandr -lGL $(OBJ): %.o: %.cpp $(CPP) -o $@ -c $< $(CFLAGS) - + .PHONY: clean mrproper clean: @rm -rf $(OBJ) mrproper: clean - @rm -rf $(LIBNAME) + @rm -rf $(FULLLIBNAME) install: - @($(CP) $(LIBNAME) $(DESTLIBDIR) $(INSTALL)) + objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME) + objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME) + $(LINK)