Modified the Linux build system so that makefiles are now outside the source tree

git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/branches/sfml2@1477 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
laurentgom 2010-03-23 15:55:07 +00:00
parent fd8fa4e2f8
commit ca5489a5d6
21 changed files with 477 additions and 21 deletions

50
build/make/Makefile Normal file
View file

@ -0,0 +1,50 @@
export SRCROOT = ../../src/SFML
export DESTDIR = /usr/local
export DESTLIBDIR = $(DESTDIR)/lib
export DESTINCDIR = $(DESTDIR)/include
export DESTDBGDIR = $(DESTLIBDIR)/debug/$(DESTLIBDIR)
export CC = gcc
export CPP = g++
export CFLAGS = -W -Wall -pedantic -g -O2 -DNDEBUG -I../../include -I../../src -fPIC
export CFLAGSEXT = -I../../include -I../../src -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 LIBS = system window graphics audio network
all: sfml
sfml: $(LIBS)
samples:
cd ../../samples/build/make && $(MAKE)
$(LIBS):
mkdir -p $(LIBPATH)
$(MAKE) -f Makefile.$@
install:
mkdir -p $(DESTLIBDIR)
mkdir -p $(DESTINCDIR)
mkdir -p $(DESTDBGDIR)
$(CP) -r ../../include/SFML/ $(DESTINCDIR)/
find $(DESTINCDIR)/SFML -name .svn -type d -print0 | xargs -0 /bin/rm -rf
$(MAKE) $@ -f Makefile.system
$(MAKE) $@ -f Makefile.window
$(MAKE) $@ -f Makefile.graphics
$(MAKE) $@ -f Makefile.audio
$(MAKE) $@ -f Makefile.network
clean mrproper:
$(MAKE) $@ -f Makefile.system
$(MAKE) $@ -f Makefile.window
$(MAKE) $@ -f Makefile.graphics
$(MAKE) $@ -f Makefile.audio
$(MAKE) $@ -f Makefile.network
cd ../../samples/build/make && $(MAKE) $@
.PHONY: clean mrproper

28
build/make/Makefile.audio Normal file
View file

@ -0,0 +1,28 @@
SRC = $(wildcard $(SRCROOT)/Audio/*.cpp)
OBJ = $(SRC:.cpp=.o)
LIB = libsfml-audio.so
LIBNAME = $(LIB).$(VERSION)
FULLLIBNAME = $(LIBPATH)/$(LIBNAME)
LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB)
all: $(LIB)
libsfml-audio.so: $(OBJ)
$(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) -lsndfile -lopenal
$(OBJ): %.o: %.cpp
$(CPP) -o $@ -c $< $(CFLAGS)
.PHONY: clean mrproper
clean:
rm -rf $(OBJ)
mrproper: clean
rm -rf $(FULLLIBNAME)
install:
objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME)
objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME)
$(LINK)

View file

@ -0,0 +1,44 @@
SRC = $(wildcard $(SRCROOT)/Graphics/*.cpp $(SRCROOT)/Graphics/Linux/*.cpp)
SRCGLEW = $(wildcard $(SRCROOT)/Graphics/GLEW/*.c)
SRCJPEG = $(wildcard $(SRCROOT)/Graphics/libjpeg/*.c)
SRCPNG = $(wildcard $(SRCROOT)/Graphics/libpng/*.c)
SRCSOIL = $(wildcard $(SRCROOT)/Graphics/SOIL/*.c)
SRCZLIB = $(wildcard $(SRCROOT)/Graphics/zlib/*.c)
OBJ = $(SRC:.cpp=.o)
OBJGLEW = $(SRCGLEW:.c=.o)
OBJJPEG = $(SRCJPEG:.c=.o)
OBJPNG = $(SRCPNG:.c=.o)
OBJSOIL = $(SRCSOIL:.c=.o)
OBJZLIB = $(SRCZLIB:.c=.o)
LIB = libsfml-graphics.so
LIBNAME = $(LIB).$(VERSION)
FULLLIBNAME = $(LIBPATH)/$(LIBNAME)
LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB)
all: $(LIB)
libsfml-graphics.so: $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB)
$(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
$(OBJSOIL): %.o: %.c
$(CC) -o $@ -c $< $(CFLAGSEXT) -DSTBI_FAILURE_USERMSG
$(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJZLIB): %.o: %.c
$(CC) -o $@ -c $< $(CFLAGSEXT)
.PHONY: clean mrproper
clean:
rm -rf $(OBJ) $(OBJGLEW) $(OBJJPEG) $(OBJPNG) $(OBJSOIL) $(OBJZLIB)
mrproper: clean
rm -rf $(FULLLIBNAME)
install:
objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME)
objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME)
$(LINK)

View file

@ -0,0 +1,28 @@
SRC = $(wildcard $(SRCROOT)/Network/*.cpp $(SRCROOT)/Network/Unix/*.cpp)
OBJ = $(SRC:.cpp=.o)
LIB = libsfml-network.so
LIBNAME = $(LIB).$(VERSION)
FULLLIBNAME = $(LIBPATH)/$(LIBNAME)
LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB)
all: $(LIB)
libsfml-network.so: $(OBJ)
$(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ)
$(OBJ): %.o: %.cpp
$(CPP) -o $@ -c $< $(CFLAGS)
.PHONY: clean mrproper
clean:
rm -rf $(OBJ)
mrproper: clean
rm -rf $(FULLLIBNAME)
install:
objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME)
objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME)
$(LINK)

View file

@ -0,0 +1,28 @@
SRC = $(wildcard $(SRCROOT)/System/*.cpp $(SRCROOT)/System/Unix/*.cpp)
OBJ = $(SRC:.cpp=.o)
LIB = libsfml-system.so
LIBNAME = $(LIB).$(VERSION)
FULLLIBNAME = $(LIBPATH)/$(LIBNAME)
LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB)
all: $(LIB)
libsfml-system.so: $(OBJ)
$(CPP) $(LDFLAGS) -Wl,-soname,$(LIBNAME) -o $(FULLLIBNAME) $(OBJ) -lpthread
$(OBJ): %.o: %.cpp
$(CPP) -o $@ -c $< $(CFLAGS)
.PHONY: clean mrproper
clean:
rm -rf $(OBJ)
mrproper: clean
rm -rf $(FULLLIBNAME)
install:
objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME)
objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME)
$(LINK)

View file

@ -0,0 +1,28 @@
SRC = $(wildcard $(SRCROOT)/Window/*.cpp $(SRCROOT)/Window/Linux/*.cpp)
OBJ = $(SRC:.cpp=.o)
LIB = libsfml-window.so
LIBNAME = $(LIB).$(VERSION)
FULLLIBNAME = $(LIBPATH)/$(LIBNAME)
LINK = $(LN) $(LNFLAGS) $(LIBNAME) $(DESTLIBDIR)/$(LIB)
all: $(LIB)
libsfml-window.so: $(OBJ)
$(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 $(FULLLIBNAME)
install:
objcopy --only-keep-debug $(FULLLIBNAME) $(DESTDBGDIR)/$(LIBNAME)
objcopy --strip-unneeded $(FULLLIBNAME) $(DESTLIBDIR)/$(LIBNAME)
$(LINK)