projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added using masked drawing for player on walkable tiles in BD engine
[rocksndiamonds.git]
/
src
/
Makefile
diff --git
a/src/Makefile
b/src/Makefile
index 39029a0ce9989fe885c29bc3e43df555c1886dca..7a128e75ed18b79b4e3f97cf34ff6abafe2d0479 100644
(file)
--- a/
src/Makefile
+++ b/
src/Makefile
@@
-39,11
+39,11
@@
WINDRES = windres
CONVERT_ICON_ARGS = -transparent black -background transparent
CONVERT_ICON_ARGS = -transparent black -background transparent
+DEBUGGER = gdb -batch -ex "run" -ex "bt"
+
PROGBASE = rocksndiamonds
PROGNAME = ../$(PROGBASE)
PROGBASE = rocksndiamonds
PROGNAME = ../$(PROGBASE)
-EDITION ?= default
-
# -----------------------------------------------------------------------------
# configuring platform
# -----------------------------------------------------------------------------
# configuring platform
@@
-60,14
+60,18
@@
endif
ifeq ($(PLATFORM),emscripten) # compiling with Emscripten
PROGNAME = ../$(PROGBASE).js
ifeq ($(PLATFORM),emscripten) # compiling with Emscripten
PROGNAME = ../$(PROGBASE).js
+DATA_FILE = $(PROGBASE).data
CC = emcc
AR = emar
RANLIB = emranlib
STRIP = true
CC = emcc
AR = emar
RANLIB = emranlib
STRIP = true
+FILE_PACKAGER = file_packager
endif
endif
-ifdef BUILD_DIST # distribution build
ifeq ($(shell uname -s),Darwin) # compiling on Mac OS X
ifeq ($(shell uname -s),Darwin) # compiling on Mac OS X
+DEBUGGER = lldb --batch -o "run" -k "bt" -k "quit"
+SANITIZING_FLAGS = -fsanitize=undefined
+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)
MAC_TARGET_VERSION_MIN = 10.7
EXTRA_FLAGS_MAC = -mmacosx-version-min=$(MAC_TARGET_VERSION_MIN)
EXTRA_CFLAGS = $(EXTRA_FLAGS_MAC)
@@
-76,6
+80,11
@@
MACOSX_DEPLOYMENT_TARGET = $MAC_TARGET_VERSION_MIN
endif
endif
endif
endif
+ifeq ($(shell uname -s),OS/2) # compiling on OS/2
+PROGNAME = ../$(PROGBASE).exe
+EXTRA_LDFLAGS = -Zomf -Zbin-files -Zmap -lcx -Zhigh-mem
+endif
+
# -----------------------------------------------------------------------------
# configuring target
# -----------------------------------------------------------------------------
# configuring target
@@
-94,10
+103,12
@@
endif
ifeq ($(TARGET),sdl2) # compiling for SDL2 target
ifeq ($(PLATFORM),emscripten)
ifeq ($(TARGET),sdl2) # compiling for SDL2 target
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"]'
+SDL_LIBS = -s USE_SDL_IMAGE=2 -s USE_SDL_MIXER=2 -s USE_SDL_NET=2 -s USE_
MODPLUG=1 -s USE_MPG123=1 -s USE_
ZLIB=1
+SDL_FMTS = -s SDL2_IMAGE_FORMATS='["bmp","png","pcx","xpm"]'
-s SDL2_MIXER_FORMATS='["mod","mp3"]'
EXTRA_CFLAGS = $(SDL_LIBS)
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 -lidbfs.js
+EXTRA_LDFLAGS = $(SDL_FMTS) -s INITIAL_MEMORY=81920000 -s ALLOW_MEMORY_GROWTH=1 -s FORCE_FILESYSTEM -s NO_EXIT_RUNTIME=0 -s ASYNCIFY -O2 -lidbfs.js
+DATA_DIRS = conf docs levels graphics sounds music
+FILE_PACKAGER_ARGS = --preload $(DATA_DIRS) --js-output=$(DATA_FILE).js
else
SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net
endif
else
SDL_LIBS = -lSDL2_image -lSDL2_mixer -lSDL2_net
endif
@@
-111,37
+122,39
@@
endif
# configuring compile-time definitions
# -----------------------------------------------------------------------------
# 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)\""
-endif
-
-ifdef RW_GAME_DIR # path to writable game data specified
-CONFIG_RW_GAME_DIR = -DRW_GAME_DIR="\"$(RW_GAME_DIR)\""
+ifdef BASE_PATH # path to read-only game data
+CONFIG_BASE_PATH = -DBASE_PATH="\"$(BASE_PATH)\""
endif
endif
-CONFIG = $(CONFIG_
RO_GAME_DIR) $(CONFIG_RW_GAME_DIR
) $(JOYSTICK)
+CONFIG = $(CONFIG_
BASE_PATH
) $(JOYSTICK)
DEBUG = -DDEBUG -g
DEBUG = -DDEBUG -g
-# PROFILING = $(PROFILING_FLAGS)
+# ANALYZE = $(PROFILING_FLAGS)
+# ANALYZE = $(SANITIZING_FLAGS)
# OPTIONS = $(DEBUG) -Wall # only for debugging purposes
# OPTIONS = $(DEBUG) -O2 -Wall # only for debugging purposes
# OPTIONS = $(DEBUG) -Wall # only for debugging purposes
OPTIONS = $(DEBUG) -Wall -Wstrict-prototypes -Wmissing-prototypes
# OPTIONS = $(DEBUG) -Wall # only for debugging purposes
# OPTIONS = $(DEBUG) -O2 -Wall # only for debugging purposes
# OPTIONS = $(DEBUG) -Wall # only for debugging purposes
OPTIONS = $(DEBUG) -Wall -Wstrict-prototypes -Wmissing-prototypes
+# OPTIONS = $(DEBUG) -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes
# OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes
# OPTIONS = -O2 -Wall -ansi -pedantic
# OPTIONS = -O2 -Wall
# OPTIONS = -O2
# OPTIONS = $(DEBUG) -Wall -ansi -pedantic # only for debugging purposes
# OPTIONS = -O2 -Wall -ansi -pedantic
# 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'%")
OPTIONS = -O2 -Wall
endif
ifdef BUILD_DIST # distribution build
SYS_LDFLAGS := $(shell echo $(SYS_LDFLAGS) | \
sed -e "s%-rpath,[^ ]*%-rpath,'\$$ORIGIN/lib'%")
OPTIONS = -O2 -Wall
endif
-CFLAGS = $(OPTIONS) $(SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG)
-LDFLAGS = $(SYS_LDFLAGS) $(EXTRA_LDFLAGS)
+CFLAGS = $(OPTIONS) $(
ANALYZE) $(
SYS_CFLAGS) $(EXTRA_CFLAGS) $(CONFIG)
+LDFLAGS = $(
ANALYZE) $(
SYS_LDFLAGS) $(EXTRA_LDFLAGS)
SRCS = main.c \
SRCS = main.c \
@@
-159,6
+172,7
@@
SRCS = main.c \
files.c \
tape.c \
anim.c \
files.c \
tape.c \
anim.c \
+ api.c \
network.c \
netserv.c
network.c \
netserv.c
@@
-177,6
+191,7
@@
OBJS = main.o \
files.o \
tape.o \
anim.o \
files.o \
tape.o \
anim.o \
+ api.o \
network.o \
netserv.o
network.o \
netserv.o
@@
-189,6
+204,8
@@
CNFS = conf_gfx.h \
conf_cus.h \
conf_grp.c \
conf_grp.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 \
conf_e2g.c \
conf_esg.c \
conf_e2s.c \
@@
-218,6
+235,9
@@
SOURCE_HASH_STRING ?= $(shell test -d ../.git && test `git ls-files -m | wc -l`
LIBGAME_DIR = libgame
LIBGAME = $(LIBGAME_DIR)/libgame.a
LIBGAME_DIR = libgame
LIBGAME = $(LIBGAME_DIR)/libgame.a
+GAME_BD_DIR = game_bd
+GAME_BD = $(GAME_BD_DIR)/game_bd.a
+
GAME_EM_DIR = game_em
GAME_EM = $(GAME_EM_DIR)/game_em.a
GAME_EM_DIR = game_em
GAME_EM = $(GAME_EM_DIR)/game_em.a
@@
-227,14
+247,14
@@
GAME_SP = $(GAME_SP_DIR)/game_sp.a
GAME_MM_DIR = game_mm
GAME_MM = $(GAME_MM_DIR)/game_mm.a
GAME_MM_DIR = game_mm
GAME_MM = $(GAME_MM_DIR)/game_mm.a
-RNDLIBS = $(
LIBGAME) $(GAME_EM) $(GAME_SP) $(GAME_MM
)
+RNDLIBS = $(
GAME_BD) $(GAME_EM) $(GAME_SP) $(GAME_MM) $(LIBGAME
)
AUTOCONF = conf_gfx.h conf_snd.h conf_mus.h
ICONBASE = windows_icon
AUTOCONF = conf_gfx.h conf_snd.h conf_mus.h
ICONBASE = windows_icon
-ICON_BASEPATH = ../
Special/Icons/windows_
icons
+ICON_BASEPATH = ../
build-projects/windows/
icons
ifeq ($(PLATFORM_BASE),cross-win)
ifeq ($(PLATFORM_BASE),cross-win)
-ICON_PATH = $(ICON_BASEPATH)
/$(EDITION)
+ICON_PATH = $(ICON_BASEPATH)
ICON = $(ICONBASE).o
endif
ICON = $(ICONBASE).o
endif
@@
-245,19
+265,27
@@
GRAPHICS_DIR = ../graphics
# build targets
# -----------------------------------------------------------------------------
# build targets
# -----------------------------------------------------------------------------
-all: $(AUTOCONF) libgame_dir game_em_dir game_sp_dir game_mm_dir $(PROGNAME) graphics_dir
+all: $(AUTOCONF) libgame_dir game_
bd_dir game_
em_dir game_sp_dir game_mm_dir $(PROGNAME) graphics_dir
$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(COMMIT_HASH_FILE) $(OBJS) $(ICON)
$(PROGNAME): $(RNDLIBS) $(TIMESTAMP_FILE) $(COMMIT_HASH_FILE) $(OBJS) $(ICON)
- $(CC) $(
PROFILING) $(
OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME)
+ $(CC) $(OBJS) $(ICON) $(RNDLIBS) $(LDFLAGS) -o $(PROGNAME)
ifdef BUILD_DIST
$(STRIP) $(PROGNAME)
endif
ifdef BUILD_DIST
$(STRIP) $(PROGNAME)
endif
+ifeq ($(PLATFORM),emscripten)
+ (cd .. ; $(FILE_PACKAGER) $(DATA_FILE) $(FILE_PACKAGER_ARGS))
+endif
libgame_dir:
@$(MAKE) -C $(LIBGAME_DIR)
$(LIBGAME):
@$(MAKE) -C $(LIBGAME_DIR)
libgame_dir:
@$(MAKE) -C $(LIBGAME_DIR)
$(LIBGAME):
@$(MAKE) -C $(LIBGAME_DIR)
+game_bd_dir:
+ @$(MAKE) -C $(GAME_BD_DIR)
+$(GAME_BD):
+ @$(MAKE) -C $(GAME_BD_DIR)
+
game_em_dir:
@$(MAKE) -C $(GAME_EM_DIR)
$(GAME_EM):
game_em_dir:
@$(MAKE) -C $(GAME_EM_DIR)
$(GAME_EM):
@@
-302,6
+330,8
@@
conf-hash:
@echo '#define SOURCE_HASH_STRING "$(SOURCE_HASH_STRING)"' \
> $(COMMIT_HASH_FILE)
@echo '#define SOURCE_HASH_STRING "$(SOURCE_HASH_STRING)"' \
> $(COMMIT_HASH_FILE)
+config.o: config.c $(TIMESTAMP_FILE)
+
$(TIMESTAMP_FILE): $(SRCS) $(RNDLIBS)
@$(MAKE) conf-time
$(TIMESTAMP_FILE): $(SRCS) $(RNDLIBS)
@$(MAKE) conf-time
@@
-309,18
+339,18
@@
$(COMMIT_HASH_FILE): $(SRCS) $(RNDLIBS)
@$(MAKE) conf-hash
$(ICON):
@$(MAKE) conf-hash
$(ICON):
-# $(CONVERT) $(ICON32X32) $(CONVERT_ICON_ARGS) $(ICONBASE).ico
$(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico
echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON)
.c.o:
$(CONVERT) $(ICON_PATH)/*.png $(CONVERT_ICON_ARGS) $(ICONBASE).ico
echo "$(ICONBASE) ICON $(ICONBASE).ico" | $(WINDRES) -o $(ICON)
.c.o:
- $(CC) $(
PROFILING) $(
CFLAGS) -c $*.c
+ $(CC) $(CFLAGS) -c $*.c
graphics_dir:
@test -f $(GRAPHICS_DIR)/Makefile && $(MAKE) -C $(GRAPHICS_DIR) || true
clean-obj:
$(MAKE) -C $(LIBGAME_DIR) clean
graphics_dir:
@test -f $(GRAPHICS_DIR)/Makefile && $(MAKE) -C $(GRAPHICS_DIR) || true
clean-obj:
$(MAKE) -C $(LIBGAME_DIR) clean
+ $(MAKE) -C $(GAME_BD_DIR) clean
$(MAKE) -C $(GAME_EM_DIR) clean
$(MAKE) -C $(GAME_SP_DIR) clean
$(MAKE) -C $(GAME_MM_DIR) clean
$(MAKE) -C $(GAME_EM_DIR) clean
$(MAKE) -C $(GAME_SP_DIR) clean
$(MAKE) -C $(GAME_MM_DIR) clean
@@
-354,7
+384,7
@@
run:
cd .. && ./$(PROGBASE) --verbose
gdb:
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
valgrind:
cd .. && valgrind -v --leak-check=yes ./$(PROGBASE) 2> valgrind.out
@@
-365,15
+395,24
@@
valgrind:
# -----------------------------------------------------------------------------
tags:
# -----------------------------------------------------------------------------
tags:
- $(ETAGS) *.[ch] $(LIBGAME_DIR)/*.[ch] $(GAME_EM_DIR)/*.[ch] $(GAME_SP_DIR)/*.[ch] $(GAME_MM_DIR)/*.[ch]
+ $(ETAGS) *.[ch] $(LIBGAME_DIR)/*.[ch] $(GAME_
BD_DIR)/*.[ch] $(GAME_
EM_DIR)/*.[ch] $(GAME_SP_DIR)/*.[ch] $(GAME_MM_DIR)/*.[ch]
depend:
$(MAKE) -C $(LIBGAME_DIR) depend
depend:
$(MAKE) -C $(LIBGAME_DIR) depend
+ $(MAKE) -C $(GAME_BD_DIR) depend
$(MAKE) -C $(GAME_EM_DIR) depend
$(MAKE) -C $(GAME_SP_DIR) depend
$(MAKE) -C $(GAME_MM_DIR) depend
for i in $(SRCS); do $(CPP) $(CFLAGS) -M $$i; done > .depend
$(MAKE) -C $(GAME_EM_DIR) depend
$(MAKE) -C $(GAME_SP_DIR) depend
$(MAKE) -C $(GAME_MM_DIR) depend
for i in $(SRCS); do $(CPP) $(CFLAGS) -M $$i; done > .depend
+depend-clean:
+ $(MAKE) -C $(LIBGAME_DIR) depend-clean
+ $(MAKE) -C $(GAME_BD_DIR) depend-clean
+ $(MAKE) -C $(GAME_EM_DIR) depend-clean
+ $(MAKE) -C $(GAME_SP_DIR) depend-clean
+ $(MAKE) -C $(GAME_MM_DIR) depend-clean
+ $(RM) .depend
+
ifeq (.depend,$(wildcard .depend))
include .depend
endif
ifeq (.depend,$(wildcard .depend))
include .depend
endif