|
Line
Link Here
|
| 0 |
-- Makefile |
0 |
++ Makefile |
|
Lines 2-8
Link Here
|
| 2 |
|
2 |
|
| 3 |
include Makefile.conf |
3 |
include Makefile.conf |
| 4 |
|
4 |
|
| 5 |
CFLAGS += $(SGE_CFLAGS) -fPIC $(FT_CFLAGS) |
5 |
CXXFLAGS += $(SGE_CFLAGS) -fPIC $(FT_CFLAGS) |
| 6 |
LIBS =$(SGE_LIBS) |
6 |
LIBS =$(SGE_LIBS) |
| 7 |
|
7 |
|
| 8 |
SGE_VER = 030809 |
8 |
SGE_VER = 030809 |
|
Lines 10-29
Link Here
|
| 10 |
|
10 |
|
| 11 |
OBJECTS=sge_surface.o sge_primitives.o sge_tt_text.o sge_bm_text.o sge_misc.o sge_textpp.o sge_blib.o sge_rotation.o sge_collision.o sge_shape.o |
11 |
OBJECTS=sge_surface.o sge_primitives.o sge_tt_text.o sge_bm_text.o sge_misc.o sge_textpp.o sge_blib.o sge_rotation.o sge_collision.o sge_shape.o |
| 12 |
|
12 |
|
| 13 |
all: config $(OBJECTS) |
13 |
SHARED_LIB=libSGE.so.$(API_VER) |
| 14 |
@ar rsc libSGE.a $(OBJECTS) |
14 |
STATIC_LIB=libSGE.a |
| 15 |
|
15 |
|
| 16 |
$(OBJECTS): %.o:%.cpp %.h #Each object depends on thier .cpp and .h file |
16 |
all: $(SHARED_LIB) $(STATIC_LIB) |
| 17 |
$(CXX) $(CFLAGS) -c $< |
|
|
| 18 |
|
17 |
|
| 19 |
shared: all |
|
|
| 20 |
$(CXX) $(CFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) |
| 21 |
|
18 |
|
| 22 |
shared-strip: shared |
19 |
$(OBJECTS): sge_config.h |
|
|
20 |
$(OBJECTS): %.o:%.cpp %.h #Each object depends on their .cpp and .h file |
| 21 |
$(CXX) $(CXXFLAGS) -c $< |
| 22 |
|
| 23 |
$(STATIC_LIB): $(OBJECTS) |
| 24 |
$(AR) rsc libSGE.a $(OBJECTS) |
| 25 |
|
| 26 |
$(SHARED_LIB): $(OBJECTS) |
| 27 |
$(CXX) $(CXXFLAGS) $(LDFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) |
| 28 |
|
| 29 |
shared-strip: $(SHARED_LIB) |
| 23 |
@strip libSGE.so |
30 |
@strip libSGE.so |
| 24 |
|
31 |
|
| 25 |
# Building a dll... I have no idea how to do this, but it should be something like below. |
32 |
# Building a dll... I have no idea how to do this, but it should be something like below. |
| 26 |
dll: config $(OBJECTS) |
33 |
dll: sge_config.h $(OBJECTS) |
| 27 |
dlltool --output-def SGE.def $(OBJECTS) |
34 |
dlltool --output-def SGE.def $(OBJECTS) |
| 28 |
dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) |
35 |
dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) |
| 29 |
|
36 |
|
|
Lines 33-53
Link Here
|
| 33 |
clean: |
39 |
clean: |
| 34 |
@rm -f *.o *.so *.a *.dll *.def |
40 |
@rm -f *.o *.so *.a *.dll *.def |
| 35 |
|
41 |
|
| 36 |
config: |
42 |
sge_config.h: |
| 37 |
@echo "/* SGE Config header (generated automatically) */" >sge_config.h |
43 |
@echo "/* SGE Config header (generated automatically) */" >sge_config.h.tmp |
| 38 |
@echo "#define SGE_VER $(SGE_VER)" >>sge_config.h |
44 |
@echo "#define SGE_VER $(SGE_VER)" >>sge_config.h.tmp |
| 39 |
ifeq ($(C_COMP),y) |
45 |
ifeq ($(C_COMP),y) |
| 40 |
@echo "#define _SGE_C_AND_CPP" >>sge_config.h |
46 |
@echo "#define _SGE_C_AND_CPP" >>sge_config.h.tmp |
| 41 |
endif |
47 |
endif |
| 42 |
ifeq ($(USE_FT),n) |
48 |
ifeq ($(USE_FT),n) |
| 43 |
@echo "#define _SGE_NOTTF" >>sge_config.h |
49 |
@echo "#define _SGE_NOTTF" >>sge_config.h.tmp |
| 44 |
endif |
50 |
endif |
| 45 |
ifeq ($(USE_IMG),y) |
51 |
ifeq ($(USE_IMG),y) |
| 46 |
@echo "#define _SGE_HAVE_IMG" >>sge_config.h |
52 |
@echo "#define _SGE_HAVE_IMG" >>sge_config.h.tmp |
| 47 |
endif |
53 |
endif |
| 48 |
ifeq ($(NO_CLASSES),y) |
54 |
ifeq ($(NO_CLASSES),y) |
| 49 |
@echo "#define _SGE_NO_CLASSES" >>sge_config.h |
55 |
@echo "#define _SGE_NO_CLASSES" >>sge_config.h.tmp |
| 50 |
endif |
56 |
endif |
|
|
57 |
mv sge_config.h.tmp sge_config.h |
| 51 |
|
58 |
|
| 52 |
ifneq ($(QUIET),y) |
59 |
ifneq ($(QUIET),y) |
| 53 |
@echo "== SGE r$(SGE_VER)" |
60 |
@echo "== SGE r$(SGE_VER)" |
|
Lines 70-82
Link Here
|
| 70 |
@echo "" |
77 |
@echo "" |
| 71 |
endif |
78 |
endif |
| 72 |
|
79 |
|
| 73 |
install: shared |
80 |
install: $(SHARED_LIB) $(STATIC_LIB) |
| 74 |
@mkdir -p $(PREFIX_H) |
81 |
@mkdir -p $(DESTDIR)$(PREFIX_H) |
| 75 |
install -c -m 644 sge*.h $(PREFIX_H) |
82 |
install -c -m 644 sge*.h $(DESTDIR)$(PREFIX_H) |
| 76 |
@mkdir -p $(PREFIX)/lib |
83 |
@mkdir -p $(DESTDIR)$(PREFIX)/lib |
| 77 |
install -c -m 644 libSGE.a $(PREFIX)/lib |
84 |
install -c -m 644 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib |
| 78 |
install -c libSGE.so $(PREFIX)/lib/libSGE.so.$(API_VER).$(SGE_VER) |
85 |
install -c libSGE.so $(DESTDIR)$(PREFIX)/lib/libSGE.so.$(API_VER).$(SGE_VER) |
| 79 |
@cd $(PREFIX)/lib;\ |
86 |
@cd $(DESTDIR)$(PREFIX)/lib;\ |
| 80 |
ln -sf libSGE.so.$(API_VER).$(SGE_VER) libSGE.so.$(API_VER);\ |
87 |
ln -sf libSGE.so.$(API_VER).$(SGE_VER) libSGE.so.$(API_VER);\ |
| 81 |
ln -sf libSGE.so.$(API_VER) libSGE.so |
88 |
ln -sf libSGE.so.$(API_VER) libSGE.so |
| 82 |
@echo "** Headerfiles installed in $(PREFIX_H)" |
89 |
@echo "** Headerfiles installed in $(PREFIX_H)" |
| 83 |
-- Makefile.conf |
90 |
++ Makefile.conf |
|
Lines 11-16
Link Here
|
| 11 |
# Compilers (C and C++) |
11 |
# Compilers (C and C++) |
| 12 |
CC=gcc |
12 |
CC=gcc |
| 13 |
CXX=g++ |
13 |
CXX=g++ |
|
|
14 |
AR=ar |
| 14 |
|
15 |
|
| 15 |
# Make sure sdl-config is available |
16 |
# Make sure sdl-config is available |
| 16 |
HAVE_SDL =$(shell if (sdl-config --version) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) |
17 |
HAVE_SDL =$(shell if (sdl-config --version) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) |
|
Lines 25-35
Link Here
|
| 25 |
PREFIX_H =$(shell sdl-config --prefix)/include/SDL |
26 |
PREFIX_H =$(shell sdl-config --prefix)/include/SDL |
| 26 |
|
27 |
|
| 27 |
# Flags passed to the compiler |
28 |
# Flags passed to the compiler |
| 28 |
CFLAGS =-Wall -O3 -ffast-math |
29 |
CXXFLAGS ?=-O3 -ffast-math |
| 29 |
SGE_CFLAGS =$(shell sdl-config --cflags) |
30 |
SGE_CFLAGS =$(shell sdl-config --cflags) |
| 30 |
# Uncomment to make some more optimizations |
31 |
# Uncomment to make some more optimizations |
| 31 |
#CFLAGS =-Wall -O9 -ffast-math -march=i686 |
32 |
#CXXFLAGS ?=-O9 -ffast-math -march=i686 |
| 32 |
|
33 |
|
|
|
34 |
# Spit out warnings |
| 35 |
CXXFLAGS += -Wall |
| 33 |
|
36 |
|
| 34 |
# Libs config |
37 |
# Libs config |
| 35 |
SGE_LIBS =$(shell sdl-config --libs) -lstdc++ |
38 |
SGE_LIBS =$(shell sdl-config --libs) -lstdc++ |