2011-10-11 06:33:45 +00:00
|
|
|
# ----------------------------------------------------- #
|
|
|
|
# Makefile for the CTF game module for Quake II #
|
|
|
|
# #
|
|
|
|
# Just type "make" to compile the #
|
2012-07-01 08:05:20 +00:00
|
|
|
# - CTF Game (game.so / game.dll) #
|
2011-10-11 06:33:45 +00:00
|
|
|
# #
|
|
|
|
# Dependencies: #
|
|
|
|
# - None, but you need a Quake II to play. #
|
|
|
|
# While in theorie every one should work #
|
|
|
|
# Yamagi Quake II ist recommended. #
|
|
|
|
# #
|
|
|
|
# Platforms: #
|
|
|
|
# - FreeBSD #
|
2012-07-01 08:05:20 +00:00
|
|
|
# - Linux #
|
2014-02-14 10:47:30 +00:00
|
|
|
# - Mac OS X #
|
|
|
|
# - OpenBSD #
|
|
|
|
# - Windows #
|
2011-10-11 06:33:45 +00:00
|
|
|
# ----------------------------------------------------- #
|
|
|
|
|
2012-07-01 08:05:20 +00:00
|
|
|
# Detect the OS
|
|
|
|
ifdef SystemRoot
|
|
|
|
OSTYPE := Windows
|
|
|
|
else
|
2011-10-11 06:33:45 +00:00
|
|
|
OSTYPE := $(shell uname -s)
|
2012-07-01 08:05:20 +00:00
|
|
|
endif
|
2014-02-14 10:47:30 +00:00
|
|
|
|
|
|
|
# Special case for MinGW
|
|
|
|
ifneq (,$(findstring MINGW,$(OSTYPE)))
|
|
|
|
OSTYPE := Windows
|
|
|
|
endif
|
2011-10-11 06:33:45 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Base CFLAGS.
|
|
|
|
#
|
|
|
|
# -O2 are enough optimizations.
|
|
|
|
#
|
|
|
|
# -fno-strict-aliasing since the source doesn't comply
|
|
|
|
# with strict aliasing rules and it's next to impossible
|
|
|
|
# to get it there...
|
|
|
|
#
|
|
|
|
# -fomit-frame-pointer since the framepointer is mostly
|
|
|
|
# useless for debugging Quake II and slows things down.
|
|
|
|
#
|
|
|
|
# -g to build allways with debug symbols. Please do not
|
|
|
|
# change this, since it's our only chance to debug this
|
|
|
|
# crap when random crashes happen!
|
|
|
|
#
|
|
|
|
# -fPIC for position independend code.
|
|
|
|
#
|
|
|
|
# -MMD to generate header dependencies.
|
2012-10-06 07:49:04 +00:00
|
|
|
ifeq ($(OSTYPE), Darwin)
|
|
|
|
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
|
2015-05-17 16:45:26 +00:00
|
|
|
-Wall -pipe -g -fwrapv -arch i386 -arch x86_64
|
2012-10-06 07:49:04 +00:00
|
|
|
else
|
2011-10-11 06:33:45 +00:00
|
|
|
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
|
2015-05-17 16:45:26 +00:00
|
|
|
-Wall -pipe -g -MMD -fwrapv
|
2012-10-06 07:49:04 +00:00
|
|
|
endif
|
2011-10-11 06:33:45 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Base LDFLAGS.
|
2012-10-06 07:49:04 +00:00
|
|
|
ifeq ($(OSTYPE), Darwin)
|
|
|
|
LDFLAGS := -shared -arch i386 -arch x86_64
|
|
|
|
else
|
2011-10-11 06:33:45 +00:00
|
|
|
LDFLAGS := -shared
|
2012-10-06 07:49:04 +00:00
|
|
|
endif
|
2011-10-11 06:33:45 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Builds everything
|
|
|
|
all: ctf
|
|
|
|
|
|
|
|
# ----------
|
2012-07-01 08:05:20 +00:00
|
|
|
|
|
|
|
# When make is invoked by "make VERBOSE=1" print
|
|
|
|
# the compiler and linker commands.
|
|
|
|
|
|
|
|
ifdef VERBOSE
|
|
|
|
Q :=
|
|
|
|
else
|
|
|
|
Q := @
|
|
|
|
endif
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Phony targets
|
|
|
|
.PHONY : all clean ctf
|
2011-10-11 06:33:45 +00:00
|
|
|
|
2012-07-01 08:05:20 +00:00
|
|
|
# ----------
|
|
|
|
|
2011-10-11 06:33:45 +00:00
|
|
|
# Cleanup
|
2012-07-01 08:05:20 +00:00
|
|
|
clean:
|
|
|
|
@echo "===> CLEAN"
|
|
|
|
${Q}rm -Rf build release
|
|
|
|
|
2011-10-11 06:33:45 +00:00
|
|
|
# ----------
|
|
|
|
|
|
|
|
# The ctf game
|
2012-07-01 08:05:20 +00:00
|
|
|
ifeq ($(OSTYPE), Windows)
|
2011-10-11 06:33:45 +00:00
|
|
|
ctf:
|
2012-07-01 08:05:20 +00:00
|
|
|
@echo "===> Building game.dll"
|
2014-02-14 10:47:30 +00:00
|
|
|
$(Q)mkdir -p release
|
2012-07-01 08:05:20 +00:00
|
|
|
$(MAKE) release/game.dll
|
|
|
|
|
|
|
|
build/%.o: %.c
|
|
|
|
@echo "===> CC $<"
|
2014-02-14 10:47:30 +00:00
|
|
|
$(Q)mkdir -p $(@D)
|
2012-07-01 08:05:20 +00:00
|
|
|
$(Q)$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
else
|
|
|
|
ctf:
|
|
|
|
@echo "===> Building game.so"
|
|
|
|
$(Q)mkdir -p release
|
2011-10-11 06:33:45 +00:00
|
|
|
$(MAKE) release/game.so
|
|
|
|
|
|
|
|
build/%.o: %.c
|
2012-07-01 08:05:20 +00:00
|
|
|
@echo "===> CC $<"
|
|
|
|
$(Q)mkdir -p $(@D)
|
|
|
|
$(Q)$(CC) -c $(CFLAGS) -o $@ $<
|
2011-10-11 06:33:45 +00:00
|
|
|
|
2012-07-01 08:05:20 +00:00
|
|
|
release/game.so : CFLAGS += -fPIC
|
|
|
|
endif
|
|
|
|
|
2011-10-11 06:33:45 +00:00
|
|
|
# ----------
|
|
|
|
|
|
|
|
CTF_OBJS_ = \
|
|
|
|
src/g_ai.o \
|
|
|
|
src/g_chase.o \
|
|
|
|
src/g_cmds.o \
|
|
|
|
src/g_combat.o \
|
|
|
|
src/g_ctf.o \
|
|
|
|
src/g_func.o \
|
|
|
|
src/g_items.o \
|
|
|
|
src/g_main.o \
|
|
|
|
src/g_misc.o \
|
|
|
|
src/g_monster.o \
|
|
|
|
src/g_phys.o \
|
|
|
|
src/g_save.o \
|
|
|
|
src/g_spawn.o \
|
|
|
|
src/g_svcmds.o \
|
|
|
|
src/g_target.o \
|
|
|
|
src/g_trigger.o \
|
|
|
|
src/g_utils.o \
|
|
|
|
src/g_weapon.o \
|
2011-10-11 06:57:12 +00:00
|
|
|
src/menu/menu.o \
|
|
|
|
src/monster/move.o \
|
|
|
|
src/player/client.o \
|
|
|
|
src/player/hud.o \
|
|
|
|
src/player/trail.o \
|
|
|
|
src/player/view.o \
|
|
|
|
src/player/weapon.o \
|
2011-10-11 06:33:45 +00:00
|
|
|
src/shared/shared.o
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Rewrite pathes to our object directory
|
|
|
|
CTF_OBJS = $(patsubst %,build/%,$(CTF_OBJS_))
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Generate header dependencies
|
|
|
|
CTF_DEPS= $(CTF_OBJS:.o=.d)
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
|
|
|
# Suck header dependencies in
|
|
|
|
-include $(CTF_DEPS)
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2012-07-01 08:05:20 +00:00
|
|
|
ifeq ($(OSTYPE), Windows)
|
|
|
|
release/game.dll : $(CTF_OBJS)
|
|
|
|
@echo "===> LD $@"
|
|
|
|
$(Q)$(CC) $(LDFLAGS) -o $@ $(CTF_OBJS)
|
|
|
|
else
|
2011-10-11 06:33:45 +00:00
|
|
|
release/game.so : $(CTF_OBJS)
|
2012-07-01 08:05:20 +00:00
|
|
|
@echo "===> LD $@"
|
|
|
|
$(Q)$(CC) $(LDFLAGS) -o $@ $(CTF_OBJS)
|
|
|
|
endif
|
|
|
|
|
2011-10-11 06:33:45 +00:00
|
|
|
# ----------
|