2011-10-11 11:40:43 +00:00
|
|
|
# ----------------------------------------------------- #
|
|
|
|
# Makefile for the rogue game module for Quake II #
|
|
|
|
# #
|
|
|
|
# Just type "make" to compile the #
|
2011-10-11 13:41:12 +00:00
|
|
|
# - Ground Zero Game (game.so) #
|
2011-10-11 11:40:43 +00:00
|
|
|
# #
|
|
|
|
# Dependencies: #
|
|
|
|
# - None, but you need a Quake II to play. #
|
2014-02-13 07:12:18 +00:00
|
|
|
# While in theorie every client should work #
|
2011-10-11 11:40:43 +00:00
|
|
|
# Yamagi Quake II ist recommended. #
|
|
|
|
# #
|
|
|
|
# Platforms: #
|
|
|
|
# - FreeBSD #
|
2012-06-27 12:50:48 +00:00
|
|
|
# - Linux #
|
2014-02-13 07:12:18 +00:00
|
|
|
# - Mac OS X #
|
|
|
|
# - OpenBSD #
|
2012-06-27 12:50:48 +00:00
|
|
|
# - Windows #
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------------------------------------------------- #
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2012-06-27 12:50:48 +00:00
|
|
|
# Detect the OS
|
|
|
|
ifdef SystemRoot
|
|
|
|
OSTYPE := Windows
|
|
|
|
else
|
2009-03-30 12:48:38 +00:00
|
|
|
OSTYPE := $(shell uname -s)
|
2012-06-27 12:50:48 +00:00
|
|
|
endif
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2014-02-13 07:12:18 +00:00
|
|
|
# Special case for MinGW
|
|
|
|
ifneq (,$(findstring MINGW,$(OSTYPE)))
|
|
|
|
OSTYPE := Windows
|
|
|
|
endif
|
|
|
|
|
2012-06-27 12:50:48 +00:00
|
|
|
# Detect the architecture
|
|
|
|
ifeq ($(OSTYPE), Windows)
|
2016-06-11 07:47:05 +00:00
|
|
|
ifdef PROCESSOR_ARCHITEW6432
|
|
|
|
# 64 bit Windows
|
|
|
|
ARCH := $(PROCESSOR_ARCHITEW6432)
|
2012-06-27 12:50:48 +00:00
|
|
|
else
|
2016-06-11 07:47:05 +00:00
|
|
|
# 32 bit Windows
|
|
|
|
ARCH := $(PROCESSOR_ARCHITECTURE)
|
2012-06-27 12:50:48 +00:00
|
|
|
endif
|
2016-06-11 07:47:05 +00:00
|
|
|
else
|
|
|
|
# Normalize some abiguous ARCH strings
|
|
|
|
ARCH := $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
|
2009-03-30 12:48:38 +00:00
|
|
|
endif
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +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:53:43 +00:00
|
|
|
ifeq ($(OSTYPE), Darwin)
|
|
|
|
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
|
2015-05-17 16:40:49 +00:00
|
|
|
-Wall -pipe -g -fwrapv -arch i386 -arch x86_64
|
2012-10-06 07:53:43 +00:00
|
|
|
else
|
2011-10-11 11:40:43 +00:00
|
|
|
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
|
2015-05-17 16:40:49 +00:00
|
|
|
-Wall -pipe -g -MMD -fwrapv
|
2012-10-06 07:53:43 +00:00
|
|
|
endif
|
2009-03-30 12:48:38 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2016-06-11 07:47:05 +00:00
|
|
|
# Defines the operating system and architecture
|
|
|
|
CFLAGS += -DOSTYPE=\"$(OSTYPE)\" -DARCH=\"$(ARCH)\"
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Base LDFLAGS.
|
2012-10-06 07:53:43 +00:00
|
|
|
ifeq ($(OSTYPE), Darwin)
|
|
|
|
LDFLAGS := -shared -arch i386 -arch x86_64
|
|
|
|
else
|
2011-10-11 11:40:43 +00:00
|
|
|
LDFLAGS := -shared
|
2012-10-06 07:53:43 +00:00
|
|
|
endif
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Builds everything
|
|
|
|
all: rogue
|
2009-03-30 12:48:38 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2012-06-27 12:50:48 +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 rogue
|
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Cleanup
|
2012-06-27 12:50:48 +00:00
|
|
|
clean:
|
|
|
|
@echo "===> CLEAN"
|
|
|
|
${Q}rm -Rf build release
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# The rogue game
|
2012-06-27 12:50:48 +00:00
|
|
|
ifeq ($(OSTYPE), Windows)
|
2009-03-30 12:48:38 +00:00
|
|
|
rogue:
|
2012-06-27 12:50:48 +00:00
|
|
|
@echo "===> Building game.dll"
|
2014-02-13 07:12:18 +00:00
|
|
|
${Q}mkdir -p release
|
2012-06-27 12:50:48 +00:00
|
|
|
$(MAKE) release/game.dll
|
|
|
|
|
|
|
|
build/%.o: %.c
|
|
|
|
@echo "===> CC $<"
|
2014-02-13 07:12:18 +00:00
|
|
|
${Q}mkdir -p $(@D)
|
2012-06-27 12:50:48 +00:00
|
|
|
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
|
|
|
else
|
|
|
|
rogue:
|
|
|
|
@echo "===> Building game.so"
|
|
|
|
${Q}mkdir -p release
|
2009-03-30 12:48:38 +00:00
|
|
|
$(MAKE) release/game.so
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
build/%.o: %.c
|
2012-06-27 12:50:48 +00:00
|
|
|
@echo "===> CC $<"
|
|
|
|
${Q}mkdir -p $(@D)
|
|
|
|
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2012-06-27 12:50:48 +00:00
|
|
|
release/game.so : CFLAGS += -fPIC
|
|
|
|
endif
|
|
|
|
|
2009-03-30 12:48:38 +00:00
|
|
|
# ----------
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
ROGUE_OBJS_ = \
|
|
|
|
src/g_ai.o \
|
|
|
|
src/g_chase.o \
|
|
|
|
src/g_cmds.o \
|
|
|
|
src/g_combat.o \
|
|
|
|
src/g_func.o \
|
|
|
|
src/g_items.o \
|
|
|
|
src/g_main.o \
|
|
|
|
src/g_misc.o \
|
|
|
|
src/g_monster.o \
|
|
|
|
src/g_newai.o \
|
|
|
|
src/g_newdm.o \
|
|
|
|
src/g_newfnc.o \
|
|
|
|
src/g_newtarg.o \
|
|
|
|
src/g_newtrig.o \
|
|
|
|
src/g_newweap.o \
|
|
|
|
src/g_phys.o \
|
|
|
|
src/g_spawn.o \
|
|
|
|
src/g_sphere.o \
|
|
|
|
src/g_svcmds.o \
|
|
|
|
src/g_target.o \
|
|
|
|
src/g_trigger.o \
|
|
|
|
src/g_turret.o \
|
|
|
|
src/g_utils.o \
|
|
|
|
src/g_weapon.o \
|
|
|
|
src/dm/ball.o \
|
|
|
|
src/dm/tag.o \
|
|
|
|
src/monster/berserker/berserker.o \
|
|
|
|
src/monster/boss2/boss2.o \
|
|
|
|
src/monster/boss3/boss3.o \
|
|
|
|
src/monster/boss3/boss31.o \
|
|
|
|
src/monster/boss3/boss32.o \
|
|
|
|
src/monster/brain/brain.o \
|
|
|
|
src/monster/carrier/carrier.o \
|
|
|
|
src/monster/chick/chick.o \
|
|
|
|
src/monster/flipper/flipper.o \
|
|
|
|
src/monster/float/float.o \
|
|
|
|
src/monster/flyer/flyer.o \
|
|
|
|
src/monster/gladiator/gladiator.o \
|
|
|
|
src/monster/gunner/gunner.o \
|
|
|
|
src/monster/hover/hover.o \
|
|
|
|
src/monster/infantry/infantry.o \
|
|
|
|
src/monster/insane/insane.o \
|
|
|
|
src/monster/medic/medic.o \
|
|
|
|
src/monster/misc/move.o \
|
|
|
|
src/monster/mutant/mutant.o \
|
|
|
|
src/monster/parasite/parasite.o \
|
|
|
|
src/monster/soldier/soldier.o \
|
|
|
|
src/monster/stalker/stalker.o \
|
|
|
|
src/monster/supertank/supertank.o \
|
|
|
|
src/monster/tank/tank.o \
|
|
|
|
src/monster/turret/turret.o \
|
|
|
|
src/monster/widow/widow.o \
|
|
|
|
src/monster/widow/widow2.o \
|
|
|
|
src/player/client.o \
|
|
|
|
src/player/hud.o \
|
|
|
|
src/player/trail.o \
|
|
|
|
src/player/view.o \
|
|
|
|
src/player/weapon.o \
|
|
|
|
src/savegame/savegame.o \
|
|
|
|
src/shared/flash.o \
|
2012-06-27 12:50:48 +00:00
|
|
|
src/shared/rand.o \
|
2011-10-11 11:40:43 +00:00
|
|
|
src/shared/shared.o
|
2009-03-30 12:48:38 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Rewrite pathes to our object directory
|
|
|
|
ROGUE_OBJS = $(patsubst %,build/%,$(ROGUE_OBJS_))
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Generate header dependencies
|
|
|
|
ROGUE_DEPS= $(ROGUE_OBJS:.o=.d)
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# Suck header dependencies in
|
|
|
|
-include $(ROGUE_DEPS)
|
2009-03-30 12:48:38 +00:00
|
|
|
|
|
|
|
# ----------
|
|
|
|
|
2012-06-27 12:50:48 +00:00
|
|
|
ifeq ($(OSTYPE), Windows)
|
|
|
|
release/game.dll : $(ROGUE_OBJS)
|
|
|
|
@echo "===> LD $@"
|
|
|
|
${Q}$(CC) $(LDFLAGS) -o $@ $(ROGUE_OBJS)
|
2016-08-14 14:29:06 +00:00
|
|
|
else ifeq ($(OSTYPE), Darwin)
|
|
|
|
release/game.dylib : $(ROGUE_OBJS)
|
|
|
|
@echo "===> LD $@"
|
|
|
|
${Q}$(CC) $(LDFLAGS) -o $@ $(ROGUE_OBJS)
|
2012-06-27 12:50:48 +00:00
|
|
|
else
|
2009-03-30 12:48:38 +00:00
|
|
|
release/game.so : $(ROGUE_OBJS)
|
2012-06-27 12:50:48 +00:00
|
|
|
@echo "===> LD $@"
|
|
|
|
${Q}$(CC) $(LDFLAGS) -o $@ $(ROGUE_OBJS)
|
|
|
|
endif
|
2009-03-30 12:48:38 +00:00
|
|
|
|
2011-10-11 11:40:43 +00:00
|
|
|
# ----------
|