|
|
#include "sge_textpp.h" | #include "sge_textpp.h" |
| |
#ifndef _SGE_NOTTF | #ifndef _SGE_NOTTF |
|
#include <ft2build.h> |
|
#include FT_FREETYPE_H |
#include <freetype/freetype.h> | #include <freetype/freetype.h> |
#include <freetype/ftoutln.h> | #include <freetype/ftoutln.h> |
#include <freetype/ttnameid.h> | #include <freetype/ttnameid.h> |
|
|
| |
include Makefile.conf | include Makefile.conf |
| |
CFLAGS += $(SGE_CFLAGS) -fPIC $(FT_CFLAGS) |
CXXFLAGS += $(SGE_CFLAGS) -fPIC $(FT_CFLAGS) |
LIBS =$(SGE_LIBS) | LIBS =$(SGE_LIBS) |
| |
SGE_VER = 030809 | SGE_VER = 030809 |
|
|
| |
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 | 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 |
| |
all: config $(OBJECTS) |
SHARED_LIB=libSGE.so.$(API_VER) |
@ar rsc libSGE.a $(OBJECTS) |
STATIC_LIB=libSGE.a |
| |
$(OBJECTS): %.o:%.cpp %.h #Each object depends on thier .cpp and .h file |
all: $(SHARED_LIB) $(STATIC_LIB) |
$(CXX) $(CFLAGS) -c $< |
|
| |
shared: all |
|
$(CXX) $(CFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) |
|
| |
shared-strip: shared |
$(OBJECTS): sge_config.h |
|
$(OBJECTS): %.o:%.cpp %.h #Each object depends on their .cpp and .h file |
|
$(CXX) $(CXXFLAGS) -c $< |
|
|
|
$(STATIC_LIB): $(OBJECTS) |
|
$(AR) rsc libSGE.a $(OBJECTS) |
|
|
|
$(SHARED_LIB): $(OBJECTS) |
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -Wl,-soname,libSGE.so.$(API_VER) -fpic -fPIC -shared -o libSGE.so $(OBJECTS) $(LIBS) |
|
|
|
shared-strip: $(SHARED_LIB) |
@strip libSGE.so | @strip libSGE.so |
| |
# Building a dll... I have no idea how to do this, but it should be something like below. | # Building a dll... I have no idea how to do this, but it should be something like below. |
dll: config $(OBJECTS) |
dll: sge_config.h $(OBJECTS) |
dlltool --output-def SGE.def $(OBJECTS) | dlltool --output-def SGE.def $(OBJECTS) |
dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) | dllwrap --driver-name $(CXX) -o SGE.dll --def SGE.def --output-lib libSGE.a --dllname SGE.dll $(OBJECTS) $(LIBS) |
| |
|
|
clean: | clean: |
@rm -f *.o *.so *.a *.dll *.def | @rm -f *.o *.so *.a *.dll *.def |
| |
config: |
sge_config.h: |
@echo "/* SGE Config header (generated automatically) */" >sge_config.h |
@echo "/* SGE Config header (generated automatically) */" >sge_config.h.tmp |
@echo "#define SGE_VER $(SGE_VER)" >>sge_config.h |
@echo "#define SGE_VER $(SGE_VER)" >>sge_config.h.tmp |
ifeq ($(C_COMP),y) | ifeq ($(C_COMP),y) |
@echo "#define _SGE_C_AND_CPP" >>sge_config.h |
@echo "#define _SGE_C_AND_CPP" >>sge_config.h.tmp |
endif | endif |
ifeq ($(USE_FT),n) | ifeq ($(USE_FT),n) |
@echo "#define _SGE_NOTTF" >>sge_config.h |
@echo "#define _SGE_NOTTF" >>sge_config.h.tmp |
endif | endif |
ifeq ($(USE_IMG),y) | ifeq ($(USE_IMG),y) |
@echo "#define _SGE_HAVE_IMG" >>sge_config.h |
@echo "#define _SGE_HAVE_IMG" >>sge_config.h.tmp |
endif | endif |
ifeq ($(NO_CLASSES),y) | ifeq ($(NO_CLASSES),y) |
@echo "#define _SGE_NO_CLASSES" >>sge_config.h |
@echo "#define _SGE_NO_CLASSES" >>sge_config.h.tmp |
endif | endif |
|
mv sge_config.h.tmp sge_config.h |
| |
ifneq ($(QUIET),y) | ifneq ($(QUIET),y) |
@echo "== SGE r$(SGE_VER)" | @echo "== SGE r$(SGE_VER)" |
|
|
@echo "" | @echo "" |
endif | endif |
| |
install: shared |
install: $(SHARED_LIB) $(STATIC_LIB) |
@mkdir -p $(PREFIX_H) |
@mkdir -p $(DESTDIR)$(PREFIX_H) |
install -c -m 644 sge*.h $(PREFIX_H) |
install -c -m 644 sge*.h $(DESTDIR)$(PREFIX_H) |
@mkdir -p $(PREFIX)/lib |
@mkdir -p $(DESTDIR)$(PREFIX)/lib |
install -c -m 644 libSGE.a $(PREFIX)/lib |
install -c -m 644 $(STATIC_LIB) $(DESTDIR)$(PREFIX)/lib |
install -c libSGE.so $(PREFIX)/lib/libSGE.so.$(API_VER).$(SGE_VER) |
install -c libSGE.so $(DESTDIR)$(PREFIX)/lib/libSGE.so.$(API_VER).$(SGE_VER) |
@cd $(PREFIX)/lib;\ |
@cd $(DESTDIR)$(PREFIX)/lib;\ |
ln -sf libSGE.so.$(API_VER).$(SGE_VER) libSGE.so.$(API_VER);\ | ln -sf libSGE.so.$(API_VER).$(SGE_VER) libSGE.so.$(API_VER);\ |
ln -sf libSGE.so.$(API_VER) libSGE.so | ln -sf libSGE.so.$(API_VER) libSGE.so |
@echo "** Headerfiles installed in $(PREFIX_H)" | @echo "** Headerfiles installed in $(PREFIX_H)" |
|
|
# Compilers (C and C++) | # Compilers (C and C++) |
CC=gcc | CC=gcc |
CXX=g++ | CXX=g++ |
|
AR=ar |
| |
# Make sure sdl-config is available | # Make sure sdl-config is available |
HAVE_SDL =$(shell if (sdl-config --version) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) | HAVE_SDL =$(shell if (sdl-config --version) < /dev/null > /dev/null 2>&1; then echo "y"; else echo "n"; fi;) |
|
|
PREFIX_H =$(shell sdl-config --prefix)/include/SDL | PREFIX_H =$(shell sdl-config --prefix)/include/SDL |
| |
# Flags passed to the compiler | # Flags passed to the compiler |
CFLAGS =-Wall -O3 -ffast-math |
CXXFLAGS ?=-O3 -ffast-math |
SGE_CFLAGS =$(shell sdl-config --cflags) | SGE_CFLAGS =$(shell sdl-config --cflags) |
# Uncomment to make some more optimizations | # Uncomment to make some more optimizations |
#CFLAGS =-Wall -O9 -ffast-math -march=i686 |
#CXXFLAGS ?=-O9 -ffast-math -march=i686 |
| |
|
# Spit out warnings |
|
CXXFLAGS += -Wall |
| |
# Libs config | # Libs config |
SGE_LIBS =$(shell sdl-config --libs) -lstdc++ | SGE_LIBS =$(shell sdl-config --libs) -lstdc++ |
|
|
void sge_unset_cdata(sge_cdata *cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h) | void sge_unset_cdata(sge_cdata *cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h) |
{ | { |
Uint8 *map=cd->map; | Uint8 *map=cd->map; |
Sint16 offs,len; |
Sint32 offs,len; |
int i,n=0; | int i,n=0; |
| |
offs=y*cd->w + x; | offs=y*cd->w + x; |
|
|
void sge_set_cdata(sge_cdata *cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h) | void sge_set_cdata(sge_cdata *cd, Sint16 x, Sint16 y, Sint16 w, Sint16 h) |
{ | { |
Uint8 *map=cd->map; | Uint8 *map=cd->map; |
Sint16 offs,len; |
Sint32 offs,len; |
int i,n=0; | int i,n=0; |
| |
offs=y*cd->w + x; | offs=y*cd->w + x; |