| 1 |
# Makefile for the SGE library |
| 2 |
|
| 3 |
include Makefile.conf |
| 4 |
|
| 5 |
CFLAGS += $(SGE_CFLAGS) -fPIC $(FT_CFLAGS) |
| 6 |
LIBS =$(SGE_LIBS) |
| 7 |
LDFLAGS += $(CUSTOM_LDFLAGS) |
| 8 |
|
| 9 |
SGE_VER = 030809 |
| 10 |
API_VER = 0 |
| 11 |
|
| 12 |
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 |
| 13 |
|
| 14 |
all: config $(OBJECTS) |
| 15 |
ar rsc libSGE.a $(OBJECTS) |
| 16 |
|
| 17 |
$(OBJECTS): %.o:%.cpp %.h #Each object depends on thier .cpp and .h file |
| 18 |
$(CXX) $(CFLAGS) -c $< |
| 19 |
|
| 20 |
shared: all |
| 21 |
$(CXX) $(CFLAGS) $(LDFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) |
| 22 |
|
| 23 |
shared-strip: shared |
| 24 |
@strip libSGE.so |
| 25 |
|
| 26 |
# Building a dll... I have no idea how to do this, but it should be something like below. |
| 27 |
dll: config $(OBJECTS) |
| 28 |
dlltool --output-def SGE.def $(OBJECTS) |
| 29 |
dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) |
| 30 |
|
| 31 |
dll-strip: dll |
| 32 |
@strip SGE.dll |
| 33 |
|
| 34 |
clean: |
| 35 |
rm -f *.o *.so *.so.* *.a *.dll *.def |
| 36 |
|
| 37 |
config: |
| 38 |
@echo "/* SGE Config header (generated automatically) */" >sge_config.h |
| 39 |
@echo "#define SGE_VER $(SGE_VER)" >>sge_config.h |
| 40 |
ifeq ($(C_COMP),y) |
| 41 |
@echo "#define _SGE_C_AND_CPP" >>sge_config.h |
| 42 |
endif |
| 43 |
ifeq ($(USE_FT),n) |
| 44 |
@echo "#define _SGE_NOTTF" >>sge_config.h |
| 45 |
endif |
| 46 |
ifeq ($(USE_IMG),y) |
| 47 |
@echo "#define _SGE_HAVE_IMG" >>sge_config.h |
| 48 |
endif |
| 49 |
ifeq ($(NO_CLASSES),y) |
| 50 |
@echo "#define _SGE_NO_CLASSES" >>sge_config.h |
| 51 |
endif |
| 52 |
|
| 53 |
ifneq ($(QUIET),y) |
| 54 |
@echo "== SGE r$(SGE_VER)" |
| 55 |
ifeq ($(C_COMP),y) |
| 56 |
@echo "== Note: Trying to be C friendly." |
| 57 |
endif |
| 58 |
ifeq ($(USE_FT),n) |
| 59 |
@echo "== FreeType2 support disabled." |
| 60 |
else |
| 61 |
@echo "== FreeType2 support enabled." |
| 62 |
endif |
| 63 |
ifeq ($(USE_IMG),y) |
| 64 |
@echo "== SDL_Image (SFont) support enabled." |
| 65 |
else |
| 66 |
@echo "== SDL_Image (SFont) support disabled." |
| 67 |
endif |
| 68 |
ifeq ($(NO_CLASSES),y) |
| 69 |
@echo "== Warning: No C++ classes will be build!" |
| 70 |
endif |
| 71 |
@echo "" |
| 72 |
endif |
| 73 |
|
| 74 |
install: shared |
| 75 |
@mkdir -p $(PREFIX_H) |
| 76 |
install -c -m 644 sge*.h $(PREFIX_H) |
| 77 |
@mkdir -p $(PREFIX)/lib |
| 78 |
install -c -m 644 libSGE.a $(PREFIX)/lib |
| 79 |
install -c libSGE.so $(PREFIX)/lib/libSGE.so.$(API_VER).$(SGE_VER) |
| 80 |
@cd $(PREFIX)/lib;\ |
| 81 |
ln -sf libSGE.so.$(API_VER).$(SGE_VER) libSGE.so.$(API_VER);\ |
| 82 |
ln -sf libSGE.so.$(API_VER) libSGE.so |
| 83 |
@echo "** Headerfiles installed in $(PREFIX_H)" |
| 84 |
@echo "** Library files installed in $(PREFIX)/lib" |