added additional empty space elements (not used yet)
[rocksndiamonds.git] / src / Makefile
index e525f1f0a1bfb3a2c78e69526ea8443e932c91fc..f9fb4581ca5b7947ab0f1b588b1df918e3338286 100644 (file)
@@ -39,6 +39,8 @@ WINDRES = windres
 
 CONVERT_ICON_ARGS = -transparent black -background transparent
 
+DEBUGGER = gdb -batch -ex "run" -ex "bt"
+
 PROGBASE = rocksndiamonds
 PROGNAME = ../$(PROGBASE)
 
@@ -66,8 +68,9 @@ RANLIB = emranlib
 STRIP = true
 endif
 
-ifdef BUILD_DIST                       # distribution build
 ifeq ($(shell uname -s),Darwin)                # compiling on Mac OS X
+DEBUGGER = lldb --batch -o "run" -k "bt" -k "quit"
+ifdef BUILD_DIST                       # distribution build
 MAC_TARGET_VERSION_MIN = 10.7
 EXTRA_FLAGS_MAC = -mmacosx-version-min=$(MAC_TARGET_VERSION_MIN)
 EXTRA_CFLAGS = $(EXTRA_FLAGS_MAC)
@@ -97,7 +100,7 @@ ifeq ($(PLATFORM),emscripten)
 SDL_LIBS = -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_NET=2 -s USE_ZLIB=1
 SDL_FMTS = -s SDL2_IMAGE_FORMATS='["bmp","png","pcx","xpm"]'
 EXTRA_CFLAGS = $(SDL_LIBS)
-EXTRA_LDFLAGS = $(SDL_FMTS) -s INITIAL_MEMORY=81920000 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../graphics/ --preload-file ../sounds/ --preload-file ../levels/ --preload-file ../music/ -s NO_EXIT_RUNTIME=0 -s ASYNCIFY -O2
+EXTRA_LDFLAGS = $(SDL_FMTS) -s INITIAL_MEMORY=81920000 -s ALLOW_MEMORY_GROWTH=1 --preload-file ../conf/ --preload-file ../docs/ --preload-file ../levels/ --preload-file ../graphics/ --preload-file ../sounds/ --preload-file ../music/ -s NO_EXIT_RUNTIME=0 -s ASYNCIFY -O2 -lidbfs.js
 else
 SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net
 endif
@@ -111,15 +114,11 @@ endif
 # configuring compile-time definitions
 # -----------------------------------------------------------------------------
 
-ifdef RO_GAME_DIR                      # path to read-only game data specified
-CONFIG_RO_GAME_DIR = -DRO_GAME_DIR="\"$(RO_GAME_DIR)\""
+ifdef BASE_PATH                                        # path to read-only game data
+CONFIG_BASE_PATH = -DBASE_PATH="\"$(BASE_PATH)\""
 endif
 
-ifdef RW_GAME_DIR                      # path to writable game data specified
-CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\""
-endif
-
-CONFIG = $(CONFIG_RO_GAME_DIR) $(CONFIG_RW_GAME_DIR) $(JOYSTICK)
+CONFIG = $(CONFIG_BASE_PATH) $(JOYSTICK)
 
 DEBUG = -DDEBUG -g
 
@@ -134,6 +133,10 @@ OPTIONS = $(DEBUG) -Wall -Wstrict-prototypes -Wmissing-prototypes
 # OPTIONS = -O2 -Wall
 # OPTIONS = -O2
 
+ifdef BUILD_TEST                       # test build
+OPTIONS := $(OPTIONS) -DTESTING
+endif
+
 ifdef BUILD_DIST                       # distribution build
 SYS_LDFLAGS := $(shell echo $(SYS_LDFLAGS) |   \
                       sed -e "s%-rpath,[^ ]*%-rpath,'\$$ORIGIN/lib'%")
@@ -189,6 +192,8 @@ CNFS =      conf_gfx.h      \
        conf_cus.h      \
        conf_grp.c      \
        conf_grp.h      \
+       conf_emp.c      \
+       conf_emp.h      \
        conf_e2g.c      \
        conf_esg.c      \
        conf_e2s.c      \
@@ -354,7 +359,7 @@ run:
        cd .. && ./$(PROGBASE) --verbose
 
 gdb:
-       cd .. && gdb -batch -x GDB_COMMANDS ./$(PROGBASE)
+       cd .. && $(DEBUGGER) $(PROGBASE)
 
 valgrind:
        cd .. && valgrind -v --leak-check=yes ./$(PROGBASE) 2> valgrind.out