You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/games-rpg/eternal-lands/files/eternal-lands-1.9.3-build.p...

315 lines
16 KiB

From: Julian Ospald <hasufell@gentoo.org>
Date: Sun Jun 24 13:32:38 UTC 2012
Subject: build system
respect all flags
respect compiler
add options for DATADIR, BSD_KERNEL and DEBUG
use proper pkgconfig calls
remove needless build types
rename EXE to "el"
--- elc/Makefile.linux
+++ elc/Makefile.linux
@@ -3,16 +3,54 @@
-include make.conf
# basic compiling and linking - rarely changed
-OPTIONS = -DLINUX -DELC $(foreach FEATURE, $(FEATURES), -D$(FEATURE)) -D_7ZIP_ST
-CFLAGS=$(PLATFORM) $(CWARN) -O0 -ggdb -pipe $(OPTIONS) $(shell sdl-config --cflags) $(shell xml2-config --cflags) -fno-strict-aliasing $(EXTRA_INCLUDES)
-_CFLAGS=$(PLATFORM) -O2 -fomit-frame-pointer -ffast-math -pipe $(OPTIONS) $(shell sdl-config --cflags) $(shell xml2-config --cflags) -fno-strict-aliasing $(EXTRA_INCLUDES)
-CXXFLAGS=$(PLATFORM) $(CXXWARN) -O0 -ggdb -pipe $(OPTIONS) $(shell sdl-config --cflags) $(shell xml2-config --cflags) -fno-strict-aliasing $(EXTRA_INCLUDES)
-_CXXFLAGS=$(PLATFORM) -O3 -fomit-frame-pointer -ffast-math -pipe $(OPTIONS) $(shell sdl-config --cflags) $(shell xml2-config --cflags) -fno-strict-aliasing $(EXTRA_INCLUDES)
-
-PNG_SCREENSHOT_LIBS = -lpng
-LDFLAGS=$(shell sdl-config --libs) $(shell xml2-config --libs) -lSDL_net -lSDL_image -lopenal $(XDIR) -lGL -lGLU -lcal3d -lm $(EXTRA_LIBS) -lz -lpng -lvorbis -lvorbisfile \
- $(foreach FEATURE, $(FEATURES), $($(FEATURE)_LIBS))
-_LDFLAGS=$(XDIR) -lGL -lpthread -lstdc++
+CC ?= gcc
+CXX ?= g++
+
+# some options
+DATADIR ?= /usr/share/games/eternal-lands
+
+CPPFLAGS += -DDATA_DIR=\"$(DATADIR)\" \
+ -DLINUX \
+ -DELC \
+ $(foreach FEATURE, $(EL_FEATURES), -D$(FEATURE)) \
+ -D_7ZIP_ST
+
+ifeq ($(BSD_KERNEL),yes)
+CPPFLAGS += -DBSD
+endif
+
+ifeq ($(DEBUG),yes)
+CPPFLAGS += -DMEMORY_DEBUG
+endif
+
+CFLAGS += $(shell sdl-config --cflags) \
+ $(shell xml2-config --cflags) \
+ -fno-strict-aliasing \
+ $(EXTRA_INCLUDES)
+
+CXXFLAGS += $(shell sdl-config --cflags) \
+ $(shell xml2-config --cflags) \
+ -fno-strict-aliasing \
+ $(EXTRA_INCLUDES)
+
+LIBS += $(shell pkg-config --libs x11) \
+ $(shell sdl-config --libs) \
+ $(shell xml2-config --libs) \
+ $(shell pkg-config --libs SDL_net) \
+ $(shell pkg-config --libs SDL_image) \
+ $(shell pkg-config --libs openal) \
+ $(shell pkg-config --libs freealut) \
+ $(shell pkg-config --libs gl) \
+ $(shell pkg-config --libs glu) \
+ $(shell pkg-config --libs cal3d) \
+ $(shell pkg-config --libs libpng) \
+ $(shell pkg-config --libs vorbis) \
+ $(shell pkg-config --libs vorbisfile) \
+ $(shell pkg-config --libs zlib) \
+ -lm \
+ $(EXTRA_LIBS) \
+ $(foreach FEATURE, $(EL_FEATURES), $($(FEATURE)_LIBS)) \
+ -lstdc++
# This works on Ubuntu 8.04 (LTS) at least
# Install these packages in addition to those required for a standard build
@@ -59,7 +97,7 @@
xz/CpuArch.o xz/Delta.o xz/LzFind.o xz/Lzma2Dec.o xz/Lzma2Enc.o \
xz/LzmaDec.o xz/LzmaEnc.o xz/Sha256.o xz/Xz.o xz/XzCrc64.o xz/XzDec.o \
xz/XzEnc.o \
- $(foreach FEATURE, $(FEATURES), $($(FEATURE)_COBJ))
+ $(foreach FEATURE, $(EL_FEATURES), $($(FEATURE)_COBJ))
CXXOBJS=actor_init.o cal3d_wrapper.o context_menu.o optimizer.o sendvideoinfo.o \
exceptions/extendedexception.o xml/xmlhelper.o quest_log.o \
@@ -80,7 +118,7 @@
eye_candy/effect_mines.o eye_candy/effect_missile.o \
eye_candy/orbital_mover.o eye_candy/kepler_orbit.o \
eye_candy/effect_staff.o \
- $(foreach FEATURE, $(FEATURES), $($(FEATURE)_CXXOBJ))
+ $(foreach FEATURE, $(EL_FEATURES), $($(FEATURE)_CXXOBJ))
OBJS=$(COBJS) $(CXXOBJS)
HEADER_DIRS = . books eye_candy io pawn fsaa engine xz
@@ -89,24 +127,13 @@
DEP_FILES=$(foreach OBJ, $(COBJS), .deps/$(OBJ).P) $(foreach OBJ, $(CXXOBJS), .deps/$(OBJ).P)
#(shell echo $OBJ |sed s/\.o/\.P/))
-EXE=el.x86.linux.bin
-
-ifndef CC
-CC=gcc
-endif
-ifndef CXX
-CXX=g++
-endif
-ifndef LINK
-LINK=gcc
-endif
+EXE=el
all: $(EXE)
# the compile targets
$(EXE): $(OBJS)
- @echo " LINK $(EXE)"
- @$(LINK) $(CFLAGS) -o $(EXE) $(OBJS) $(LDFLAGS)
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $(EXE) $(OBJS) $(LIBS)
#recompile on Makefile or conf change
#.depend $(OBJS): Makefile.linux make.conf
@@ -114,25 +141,19 @@
DEPS_MAGIC := $(shell mkdir .deps .deps/io .deps/shader .deps/eye_candy .deps/exceptions .deps/xz .deps/xml .deps/fsaa .deps/engine > /dev/null 2>&1 || :)
$(COBJS): %.o: %.c Makefile.linux make.conf
- @echo " CC $@"
- @if $(CC) $(CFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@; then \
+ @echo "$(CC) $(CFLAGS) $(CPPFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@"
+ @if $(CC) $(CFLAGS) $(CPPFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@; then \
mv ".deps/$@.pp" ".deps/$@.P"; \
else rm -f ".deps/$@.pp"; exit 1; \
fi
$(CXXOBJS): %.o: %.cpp Makefile.linux make.conf
- @echo " CXX $@"
- @if $(CXX) $(CXXFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@; then \
+ @echo "$(CXX) $(CXXFLAGS) $(CPPFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@"
+ @if $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MT '$@' -MD -MP -MF '.deps/$@.pp' -c $< -o $@; then \
mv ".deps/$@.pp" ".deps/$@.P"; \
else rm -f ".deps/$@.pp"; exit 1; \
fi
-release:
- @$(MAKE) -f Makefile.linux 'CFLAGS=$(_CFLAGS)' 'CXXFLAGS=$(_CXXFLAGS)'
-
-static:
- @$(MAKE) -f Makefile.linux 'CFLAGS=$(_CFLAGS)' 'CXXFLAGS=$(_CXXFLAGS)' 'LDFLAGS=$(_LDFLAGS)' 'OBJS=$(OBJS) $(STATICLIBS)'
-
clean:
rm -f $(OBJS) $(EXE)
@@ -140,8 +161,8 @@
cd docs && doxygen Doxyfile
.depend: $(foreach HEADER_DIR, $(HEADER_DIRS), $(wildcard $(HEADER_DIR)/*.h))
- $(CC) $(CFLAGS) -MM $(patsubst %.o, %.c, $(COBJS)) >.depend
- $(CXX) $(CXXFLAGS) -MM $(patsubst %.o, %.cpp, $(CXXOBJS)) >>.depend
+ $(CC) $(CFLAGS) $(CPPFLAGS) -MM $(patsubst %.o, %.c, $(COBJS)) >.depend
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MM $(patsubst %.o, %.cpp, $(CXXOBJS)) >>.depend
make.conf: make.defaults
@if (test -f $@ -a '$(UPDATE_CONF)' != 'yes'); \
@@ -161,7 +182,7 @@
echo "\t#endinput" >> $@; \
echo "#endif" >> $@; \
echo "#define _features_included" >> $@; \
- for feature in $(FEATURES); do \
+ for feature in $(EL_FEATURES); do \
echo "#define $$feature" >> $@; \
done
--- elc/make.defaults
+++ elc/make.defaults
@@ -1,71 +1,82 @@
# set this to "no" if you don't want this file to be overwritten
UPDATE_CONF=yes
+# set to 'yes' for BSD support
+BSD_KERNEL=no
+
+# set to 'yes' to enable debug support
+DEBUG=no
+
# tune these for your setup & compile options
# IMPORTANT: if you are using a linker that needs libraries in correct order, make sure you list EYE_CANDY before PNG_SCREENSHOT if you use both
### Current release default options ###
-FEATURES += CLUSTER_INSIDES # Group objects into separate clusters for clipping on inside maps
-FEATURES += CUSTOM_LOOK # allows you to customize your look.
-FEATURES += CUSTOM_UPDATE # allows autoupdating of custom look information
-FEATURES += FUZZY_PATHS # Makes Tab Map walking not always follow exaclty the same path
-FEATURES += NEW_SOUND # Enables extended sound effects system
-FEATURES += PNG_SCREENSHOT # make screenshots in W3C's PNG format in game, requires libpng
-FEATURES += TEXT_ALIASES # Text aliases
-FEATURES += USE_INLINE # enable some optimizations to use inline functions instead of pure function calls
+EL_FEATURES += CLUSTER_INSIDES # Group objects into separate clusters for clipping on inside maps
+EL_FEATURES += CUSTOM_LOOK # allows you to customize your look.
+EL_FEATURES += CUSTOM_UPDATE # allows autoupdating of custom look information
+EL_FEATURES += FUZZY_PATHS # Makes Tab Map walking not always follow exaclty the same path
+EL_FEATURES += NEW_SOUND # Enables extended sound effects system
+EL_FEATURES += PNG_SCREENSHOT # make screenshots in W3C's PNG format in game, requires libpng
+EL_FEATURES += TEXT_ALIASES # Text aliases
+EL_FEATURES += USE_INLINE # enable some optimizations to use inline functions instead of pure function calls
# new for 1.9.0 release
-FEATURES += BANDWIDTH_SAVINGS # enable bandwidth saving changes for message protocol
+EL_FEATURES += BANDWIDTH_SAVINGS # enable bandwidth saving changes for message protocol
# new for 1.9.2 release
-FEATURES += ANIMATION_SCALING # Adds support for animation scaling, depending on the number of animation commands in the actor queue.
-FEATURES += ENCYCL_NAVIGATION # Adds context menus to encyclopedia windows with search and bookmark functions
-FEATURES += FSAA # Adds support for full screen anti-aliasing using OpenGL multisampling.
-FEATURES += NEW_NEW_CHAR_WINDOW # Use the new character creation window; controls always on-screen
-FEATURES += NEW_TEXTURES # Enables the new texture loading and caching system (http://www.eternal-lands.com/forum/index.php?showtopic=54756)
+EL_FEATURES += ANIMATION_SCALING # Adds support for animation scaling, depending on the number of animation commands in the actor queue.
+EL_FEATURES += ENCYCL_NAVIGATION # Adds context menus to encyclopedia windows with search and bookmark functions
+EL_FEATURES += FSAA # Adds support for full screen anti-aliasing using OpenGL multisampling.
+EL_FEATURES += NEW_NEW_CHAR_WINDOW # Use the new character creation window; controls always on-screen
+EL_FEATURES += NEW_TEXTURES # Enables the new texture loading and caching system (http://www.eternal-lands.com/forum/index.php?showtopic=54756)
# new for 1.9.3 release
-FEATURES += FASTER_MAP_LOAD # Enables optimizations to speed up the process of switching between maps
-FEATURES += FASTER_STARTUP # An attempt to reduce the startup time of EL somewhat
-FEATURES += MIDDLE_MOUSE_PASTE # Paste using the middle mouse button from the primary buffer on X systems
+EL_FEATURES += FASTER_MAP_LOAD # Enables optimizations to speed up the process of switching between maps
+EL_FEATURES += FASTER_STARTUP # An attempt to reduce the startup time of EL somewhat
+EL_FEATURES += MIDDLE_MOUSE_PASTE # Paste using the middle mouse button from the primary buffer on X systems
### Testing options (these options are possible for the next release and should be tested) ###
-#FEATURES += ANTI_ALIAS # allows to enable/disable anti-aliasing in el.ini
-#FEATURES += DYNAMIC_ANIMATIONS # (appears broken) Synchronizes animation to FPS instead of a fixed timer
-#FEATURES += EXT_ACTOR_DICT # Removes remaining hard-coded actor def dictionaries - requires updated actor defs files (http://el.grug.redirectme.net/actor_defs.zip)
-#FEATURES += NEW_ALPHA # (undocumented)
-#FEATURES += USE_SIMD # Enables usage of simd instructions
+#EL_FEATURES += ANTI_ALIAS # allows to enable/disable anti-aliasing in el.ini
+#EL_FEATURES += DYNAMIC_ANIMATIONS # (appears broken) Synchronizes animation to FPS instead of a fixed timer
+#EL_FEATURES += EXT_ACTOR_DICT # Removes remaining hard-coded actor def dictionaries - requires updated actor defs files (http://el.grug.redirectme.net/actor_defs.zip)
+#EL_FEATURES += NEW_ALPHA # (undocumented)
+#EL_FEATURES += USE_SIMD # Enables usage of simd instructions
### Machine specific options (fixes or performance enhancements) ###
-#FEATURES += EL_BIG_ENDIAN # Enable big-endian code (automatically detected for OSX)
-#FEATURES += NO_PF_MACRO # Use a function instead of a macro for pf_get_tile()
-#FEATURES += SIMPLE_LOD # enable a simplistic distance culling to improve performance
+#EL_FEATURES += EL_BIG_ENDIAN # Enable big-endian code (automatically detected for OSX)
+#EL_FEATURES += NO_PF_MACRO # Use a function instead of a macro for pf_get_tile()
+#EL_FEATURES += SIMPLE_LOD # enable a simplistic distance culling to improve performance
### Debug options ###
-#FEATURES += CONTEXT_MENUS_TEST # Enable "#cmtest" command to help test/demo the context menu code
-#FEATURES += DEBUG # (undocumented)
-#FEATURES += DEBUG_XML # Enables missing (optional) XML string property messages
-#FEATURES += DEBUG_POINT_PARTICLES # (undocumented)
-#FEATURES += DEBUG_TIME # Fakes the acceleration of time for use in debugging shadows and the like.
-#FEATURES += DEBUG_MAP_SOUND # Adds (some??) map boundary areas to tab maps and additional logging to stdout
-#FEATURES += ECDEBUGWIN # press ctrl-alt-c to open the Eye Candy debug window: trigger most effects without casting spells or server side events
-#FEATURES += EXTRA_DEBUG # (undocumented)
-#FEATURES += MEMORY_DEBUG # gather information about memory allocation and freeing
-#FEATURES += MISSILES_DEBUG # Enables debug for missiles feature. It will create a file missiles_log.txt file in your settings directory.
-#FEATURES += MUTEX_DEBUG # (undocumented)
-#FEATURES += OPENGL_TRACE # make far more frequent checks for OpenGL errors (requires -DDEBUG to be of any use). Will make error_log.txt a lot larger.
-#FEATURES += TIMER_CHECK # (undocumented)
-#FEATURES += _EXTRA_SOUND_DEBUG # Enable debug for sound effects
+#EL_FEATURES += CONTEXT_MENUS_TEST # Enable "#cmtest" command to help test/demo the context menu code
+#EL_FEATURES += DEBUG # (undocumented)
+#EL_FEATURES += DEBUG_XML # Enables missing (optional) XML string property messages
+#EL_FEATURES += DEBUG_POINT_PARTICLES # (undocumented)
+#EL_FEATURES += DEBUG_TIME # Fakes the acceleration of time for use in debugging shadows and the like.
+#EL_FEATURES += DEBUG_MAP_SOUND # Adds (some??) map boundary areas to tab maps and additional logging to stdout
+#EL_FEATURES += ECDEBUGWIN # press ctrl-alt-c to open the Eye Candy debug window: trigger most effects without casting spells or server side events
+#EL_FEATURES += EXTRA_DEBUG # (undocumented)
+
+# gather information about memory allocation and freeing
+ifeq ($(DEBUG),yes)
+EL_FEATURES += MEMORY_DEBUG
+endif
+
+#EL_FEATURES += MISSILES_DEBUG # Enables debug for missiles feature. It will create a file missiles_log.txt file in your settings directory.
+#EL_FEATURES += MUTEX_DEBUG # (undocumented)
+#EL_FEATURES += OPENGL_TRACE # make far more frequent checks for OpenGL errors (requires -DDEBUG to be of any use). Will make error_log.txt a lot larger.
+#EL_FEATURES += TIMER_CHECK # (undocumented)
+#EL_FEATURES += _EXTRA_SOUND_DEBUG # Enable debug for sound effects
### Other options (Experimental, unfinished, defunct or otherwise unknown) ###
-#FEATURES += NEW_CURSOR # New coloured cursors made by Emajekral (Experimental) Extract http://users.on.net/~gingerman/sky_cursor-textures.zip into datadir/textures/
-#FEATURES += PAWN # Experimental, not for release, will need server support to function properly. This *will* eat your cat. You've been warned. Enables the Pawn abstract machine.
-#FEATURES += UID # use unique ID sent from server for custom looks. (INCOMPLETE)
-#FEATURES += USE_ACTORS_OPTIMIZER # Enables actor optimizations
-#FEATURES += USE_BOOST
-#FEATURES += USE_TR1 # Needs tr1 version of c++ stl, used for NEW_FILE_IO
-#FEATURES += WRITE_XML # dangerous to use, will wipe out some XML files that are part of the main game download
-#FEATURES += ZLIBW # Enables being able to write gzip compressed files, requires -lzlib/-lz needed for map_editor
-#FEATURES += OLD_MISC_OBJ_DIR # if not defined, ./3dobjects/misc_objects/ paths becomes ./3dobjects/
+#EL_FEATURES += NEW_CURSOR # New coloured cursors made by Emajekral (Experimental) Extract http://users.on.net/~gingerman/sky_cursor-textures.zip into datadir/textures/
+#EL_FEATURES += PAWN # Experimental, not for release, will need server support to function properly. This *will* eat your cat. You've been warned. Enables the Pawn abstract machine.
+#EL_FEATURES += UID # use unique ID sent from server for custom looks. (INCOMPLETE)
+#EL_FEATURES += USE_ACTORS_OPTIMIZER # Enables actor optimizations
+#EL_FEATURES += USE_BOOST
+#EL_FEATURES += USE_TR1 # Needs tr1 version of c++ stl, used for NEW_FILE_IO
+#EL_FEATURES += WRITE_XML # dangerous to use, will wipe out some XML files that are part of the main game download
+#EL_FEATURES += ZLIBW # Enables being able to write gzip compressed files, requires -lzlib/-lz needed for map_editor
+#EL_FEATURES += OLD_MISC_OBJ_DIR # if not defined, ./3dobjects/misc_objects/ paths becomes ./3dobjects/
@@ -86,7 +97,3 @@
#EXTRA_INCLUDES=-IC:\\Programme\\Dev-Cpp\\Include
#EXTRA_LIBS=-lz
#EXTRA_STATICLIBS=libs/zlib.a
-
-CC=gcc
-CXX=g++
-LINK=gcc