yquake2remaster/Makefile

488 lines
13 KiB
Makefile
Raw Normal View History

# ------------------------------------------------------ #
# Makefile for the "Yamagi Quake 2 Client" #
# #
# Just type "make" to compile the #
# - SDL Client (quake2) #
# - Server (q2ded) #
# - SDL OpenGL-Refresher (ref_gl.so) #
# - games: #
2010-12-20 09:07:23 +00:00
# - Quake II (baseq2) #
# - Quake II - Threewave Capture The Flag (ctf) #
# #
# Dependencies: #
# - SDL 1.2 #
# - libX11 #
# - libGL #
2009-10-04 15:25:19 +00:00
# - libvorbis #
# - libogg #
2010-11-26 12:28:00 +00:00
# - X11 (libX11, Xxf86vm) #
2009-10-04 15:25:19 +00:00
# - zlib #
# #
# Platforms: #
# - Linux #
# - FreeBSD #
2010-11-26 12:28:00 +00:00
# - Maybe any other UNIX compliant system #
# supported by SDL 1.2 #
2010-11-26 12:28:00 +00:00
# ------------------------------------------------------ #
# Check the OS type
OSTYPE := $(shell uname -s)
2010-11-26 12:28:00 +00:00
# Some plattforms call it "amd64" and some "x86_64"
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/)
2010-11-26 12:28:00 +00:00
# Refuse all other plattforms as a firewall against PEBKAC
ifneq ($(ARCH),i386)
ifneq ($(ARCH),x86_64)
$(error arch $(ARCH) is currently not supported)
endif
endif
# ----------
2010-11-26 12:28:00 +00:00
# The compiler
CC := gcc
2010-11-26 12:28:00 +00:00
# ----------
2009-03-10 16:46:57 +00:00
2010-11-26 12:28:00 +00:00
# Base CFLAGS. These are extended later
# for each independet target
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer\
-fstack-protector-all -Wall -pipe -g -MMD
2009-03-05 16:34:42 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Base include path.
ifeq ($(OSTYPE),Linux)
2010-11-26 12:28:00 +00:00
INCLUDE := -I/usr/include
else ifeq ($(OSTYPE),FreeBSD)
INCLUDE := -I/usr/local/include
endif
2009-04-10 13:11:49 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Base LDFLAGS. These are extended later
# for each independet target
ifeq ($(OSTYPE),Linux)
LDFLAGS := -L/usr/lib -lm -ldl
else ifeq ($(OSTYPE),FreeBSD)
LDFLAGS := -L/usr/local/lib -lm
endif
2010-12-20 09:07:23 +00:00
# ----------
# Converter rule
# ----------
2010-11-26 12:28:00 +00:00
# Builds everything
all: client server refresher baseq2 ctf
2010-11-26 12:28:00 +00:00
# Cleanup
clean:
@echo "===> CLEAN"
@rm -Rf build release
2009-03-05 11:28:58 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# The client
client:
@echo '===> Building quake2'
@mkdir -p release
$(MAKE) release/quake2
build/client/%.o: %.c
@echo '===> CC $<'
@mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/quake2 : INCLUDE += -I/usr/include/SDL -I/usr/local/include/SDL
release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg -lz \
-lXxf86vm -lX11 \
$(shell sdl-config --libs)
# ----------
2010-11-26 12:28:00 +00:00
# The server
server:
@echo '===> Building q2ded'
@mkdir -p release
$(MAKE) release/q2ded
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
build/server/%.o: %.c
@echo '===> CC $<'
@mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
release/q2ded : CFLAGS += -DDEDICATED_ONLY
release/q2ded : LDFLAGS += -lz
2009-03-09 16:10:05 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# The refresher
refresher:
@echo '===> Building ref_gl.so'
@mkdir -p release
$(MAKE) release/ref_gl.so
2010-09-01 08:25:09 +00:00
2010-11-26 12:28:00 +00:00
build/refresher/%.o: %.c
@echo '===> CC $<'
@mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/ref_gl.so : INCLUDE += -I/usr/local/include/SDL \
-I/usr/include/SDL -I/usr/X11R6/include
2010-11-26 12:28:00 +00:00
release/ref_gl.so : CFLAGS += -fPIC
release/ref_gl.so : LDFLAGS += -shared
2010-09-01 07:41:37 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# The baseq2 game
baseq2:
@echo '===> Building baseq2'
@mkdir -p release/baseq2
$(MAKE) release/baseq2/game.so
2010-11-26 12:28:00 +00:00
build/baseq2/%.o: %.c
@echo '===> CC $<'
@mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
2010-11-26 12:28:00 +00:00
release/baseq2/game.so : CFLAGS += -fPIC
release/baseq2/game.so : LDFLAGS += -shared
2009-03-03 14:10:08 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# The ctf game
ctf:
@echo '===> Building ctf'
@mkdir -p release/ctf
$(MAKE) release/ctf/game.so
2009-03-04 15:50:05 +00:00
2010-11-26 12:28:00 +00:00
build/ctf/%.o: %.c
@echo '===> CC $<'
@mkdir -p $(@D)
@$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
2009-04-10 13:11:49 +00:00
2010-11-26 12:28:00 +00:00
release/ctf/game.so : CFLAGS += -fPIC
release/ctf/game.so : LDFLAGS += -shared
2009-04-10 13:11:49 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Used by the baseq2 game
BASEQ2_OBJS_ = \
src/game/baseq2/g_ai.o \
src/game/baseq2/g_chase.o \
src/game/baseq2/g_cmds.o \
src/game/baseq2/g_combat.o \
src/game/baseq2/g_func.o \
src/game/baseq2/g_items.o \
src/game/baseq2/g_main.o \
src/game/baseq2/g_misc.o \
src/game/baseq2/g_monster.o \
src/game/baseq2/g_phys.o \
src/game/baseq2/g_save.o \
src/game/baseq2/g_spawn.o \
src/game/baseq2/g_svcmds.o \
src/game/baseq2/g_target.o \
src/game/baseq2/g_trigger.o \
src/game/baseq2/g_turret.o \
src/game/baseq2/g_utils.o \
src/game/baseq2/g_weapon.o \
src/game/baseq2/m_actor.o \
src/game/baseq2/m_berserk.o \
src/game/baseq2/m_boss2.o \
src/game/baseq2/m_boss3.o \
src/game/baseq2/m_boss31.o \
src/game/baseq2/m_boss32.o \
src/game/baseq2/m_brain.o \
src/game/baseq2/m_chick.o \
src/game/baseq2/m_flash.o \
src/game/baseq2/m_flipper.o \
src/game/baseq2/m_float.o \
src/game/baseq2/m_flyer.o \
src/game/baseq2/m_gladiator.o \
src/game/baseq2/m_gunner.o \
src/game/baseq2/m_hover.o \
src/game/baseq2/m_infantry.o \
src/game/baseq2/m_insane.o \
src/game/baseq2/m_medic.o \
src/game/baseq2/m_move.o \
src/game/baseq2/m_mutant.o \
src/game/baseq2/m_parasite.o \
src/game/baseq2/m_soldier.o \
src/game/baseq2/m_supertank.o \
src/game/baseq2/m_tank.o \
src/game/baseq2/p_client.o \
src/game/baseq2/p_hud.o \
src/game/baseq2/p_trail.o \
src/game/baseq2/p_view.o \
src/game/baseq2/p_weapon.o \
src/game/baseq2/q_shared.o
# Used by the client
CLIENT_OBJS_ := \
src/client/cl_cin.o \
src/client/cl_console.o \
src/client/cl_download.o \
src/client/cl_effects.o \
src/client/cl_entities.o \
src/client/cl_input.o \
src/client/cl_inventory.o \
src/client/cl_keyboard.o \
src/client/cl_lights.o \
src/client/cl_main.o \
src/client/cl_network.o \
src/client/cl_parse.o \
src/client/cl_particles.o \
src/client/cl_prediction.o \
src/client/cl_screen.o \
src/client/cl_tempentities.o \
src/client/cl_view.o \
src/client/menu/menu.o \
src/client/menu/qmenu.o \
src/client/menu/videomenu.o \
src/client/sound/snd_dma.o \
src/client/sound/snd_mem.o \
src/client/sound/snd_mix.o \
src/client/sound/snd_vorbis.o \
src/client/sound/snd_wav.o
# Used by the client and the server
COMMON_OBJS_ := \
src/common/crc.o \
src/common/cvar.o \
src/common/filesystem.o \
src/common/md4.o \
src/common/misc.o \
src/common/netchan.o \
src/common/pmove.o \
src/common/szone.o \
src/common/zone.o \
src/common/command/cmd_execution.o \
src/common/command/cmd_parser.o \
src/common/command/cmd_script.o \
src/common/common/com_arg.o \
src/common/common/com_clientserver.o \
src/common/message/msg_io.o \
src/common/message/msg_read.o \
src/common/model/cm_areaportals.o \
src/common/model/cm_box.o \
src/common/model/cm_boxtracing.o \
src/common/model/cm_bsp.o \
src/common/model/cm_vis.o \
src/common/unzip/ioapi.o \
src/common/unzip/unzip.o
# Used by the ctf game
CTF_OBJS_ = \
src/game/ctf/g_ai.o \
src/game/ctf/g_chase.o \
src/game/ctf/g_cmds.o \
src/game/ctf/g_combat.o \
src/game/ctf/g_ctf.o \
src/game/ctf/g_func.o \
src/game/ctf/g_items.o \
src/game/ctf/g_main.o \
src/game/ctf/g_misc.o \
src/game/ctf/g_monster.o \
src/game/ctf/g_phys.o \
src/game/ctf/g_save.o \
src/game/ctf/g_spawn.o \
src/game/ctf/g_svcmds.o \
src/game/ctf/g_target.o \
src/game/ctf/g_trigger.o \
src/game/ctf/g_utils.o \
src/game/ctf/g_weapon.o \
src/game/ctf/m_move.o \
src/game/ctf/p_client.o \
src/game/ctf/p_hud.o \
src/game/ctf/p_menu.o \
src/game/ctf/p_trail.o \
src/game/ctf/p_view.o \
src/game/ctf/p_weapon.o \
src/game/ctf/q_shared.o
# Used by the client and the server
GAME_ABI_OBJS_ := \
src/game/baseq2/m_flash.o \
src/game/baseq2/q_shared.o
# Used by the OpenGL refresher
OPENGL_OBJS_ = \
src/refresh/r_draw.o \
src/refresh/r_image.o \
src/refresh/r_light.o \
src/refresh/r_lightmap.o \
src/refresh/r_main.o \
src/refresh/r_mesh.o \
src/refresh/r_misc.o \
src/refresh/r_model.o \
src/refresh/r_scrap.o \
src/refresh/r_surf.o \
src/refresh/r_warp.o \
src/refresh/files/md2.o \
src/refresh/files/pcx.o \
src/refresh/files/sp2.o \
src/refresh/files/tga.o \
src/refresh/files/wal.o
# Used by the OpenGL refresher
OPENGL_GAME_ABI_OBJS_ = \
src/game/baseq2/q_shared.o
# Used by the client
UNIX_CLIENT_OBJS_ := \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/network.o \
src/unix/system.o \
src/unix/vid.o
# Used by the OpenGL refresher
UNIX_OPENGL_OBJS_ = \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/qgl.o
# Used by the server
UNIX_SERVER_OBJS_ := \
src/unix/glob.o \
src/unix/hunk.o \
src/unix/misc.o \
src/unix/network.o \
src/unix/system.o
# Used by the client
SDL_OBJS_ := \
src/sdl/cd.o \
src/sdl/sound.o
# Used by the OpenGL refresher
SDL_OPENGL_OBJS_ := \
src/sdl/input.o \
src/sdl/refresh.o
# Used by the server
SERVER_OBJS_ := \
src/server/sv_cmd.o \
src/server/sv_conless.o \
src/server/sv_entities.o \
src/server/sv_game.o \
src/server/sv_init.o \
src/server/sv_main.o \
src/server/sv_save.o \
src/server/sv_send.o \
src/server/sv_user.o \
src/server/sv_world.o
2009-04-10 13:11:49 +00:00
2009-03-03 14:10:08 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Rewrite pathes to our object directory
CLIENT_COMMON_OBJS = $(patsubst %,build/client/%,$(COMMON_OBJS_))
CLIENT_GAME_ABI_OBJS = $(patsubst %,build/client/%,$(GAME_ABI_OBJS_))
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
CLIENT_SERVER_OBJS = $(patsubst %,build/client/%,$(SERVER_OBJS_))
UNIX_CLIENT_OBJS = $(patsubst %,build/client/%,$(UNIX_CLIENT_OBJS_))
SDL_OBJS = $(patsubst %,build/client/%,$(SDL_OBJS_))
2010-09-01 07:41:37 +00:00
2010-11-26 12:28:00 +00:00
SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_))
SERVER_COMMON_OBJS = $(patsubst %,build/server/%,$(COMMON_OBJS_))
SERVER_GAME_ABI_OBJS = $(patsubst %,build/server/%,$(GAME_ABI_OBJS_))
UNIX_SERVER_OBJS= $(patsubst %,build/server/%,$(UNIX_SERVER_OBJS_))
2010-09-01 07:41:37 +00:00
2010-11-26 12:28:00 +00:00
OPENGL_OBJS = $(patsubst %,build/refresher/%,$(OPENGL_OBJS_))
OPENGL_GAME_ABI_OBJS = $(patsubst %,build/refresher/%,$(OPENGL_GAME_ABI_OBJS_))
UNIX_OPENGL_OBJS = $(patsubst %,build/refresher/%,$(UNIX_OPENGL_OBJS_))
SDL_OPENGL_OBJS = $(patsubst %,build/refresher/%,$(SDL_OPENGL_OBJS_))
2010-09-01 07:41:37 +00:00
2010-11-26 12:28:00 +00:00
BASEQ2_OBJS = $(patsubst %,build/baseq2/%,$(BASEQ2_OBJS_))
2010-09-01 07:41:37 +00:00
2010-11-26 12:28:00 +00:00
CTF_OBJS = $(patsubst %,build/baseq2/%,$(CTF_OBJS_))
2010-09-01 08:58:58 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Generate header dependencies
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
CLIENT_COMMON_DEPS = $(CLIENT_COMMON_OBJS:.o=.d)
CLIENT_GAME_ABI_DEPS = $(CLIENT_GAME_ABI_OBJS:.o=.d)
CLIENT_SERVER_DEPS = $(CLIENT_SERVER_OBJS:.o=.d)
UNIX_CLIENT_DEPS = $(UNIX_CLIENT_OBJS:.o=.d)
SDL_DEPS = $(SDL_OBJS:.o=.d)
SERVER_DEPS= $(SERVER_OBJS:.o=.d)
SERVER_COMMON_DEPS= $(SERVER_COMMON_OBJS:.o=.d)
SERVER_GAME_ABI_DEPS = $(SERVER_GAME_ABI_OBJS:.o=.d)
UNIX_SERVER_DEPS= $(UNIX_SERVER_OBJS:.o=.d)
2010-11-26 12:28:00 +00:00
OPENGL_DEPS= $(OPENGL_OBJS:.o=.d)
OPENGL_GAME_ABI_DEPS= $(OPENGL_GAME_ABI_OBJS:.o=.d)
UNIX_OPENGL_DEPS= $(UNIX_OPENGL_OBJS:.o=.d)
SDL_OPENGL_DEPS= $(SDL_OPENGL_OBJS:.o=.d)
2009-03-05 11:28:58 +00:00
2010-11-26 12:28:00 +00:00
BASEQ2_DEPS= $(BASEQ2_OBJS:.o=.d)
2010-11-26 12:28:00 +00:00
CTF_DEPS= $(CTF_OBJS:.o=.d)
2009-03-05 11:28:58 +00:00
# ----------
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
# Suck header dependencies in
-include $(CLIENT_DEPS)
-include $(CLIENT_COMMON_DEPS)
-include $(CLIENT_GAME_ABI_DEPS)
-include $(CLIENT_SERVER_DEPS)
-include $(UNIX_CLIENT_DEPS)
-include $(SDL_DEPS)
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
-include $(SERVER_DEPS)
-include $(SERVER_COMMON_DEPS)
-include $(SERVER_GAME_ABI_DEPS)
-include $(UNIX_SERVER_DEPS)
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
-include $(OPENGL_DEPS)
-include $(OPENGL_GAME_ABI_DEPS)
-include $(UNIX_OPENGL_DEPS)
-include $(SDL_OPENGL_DEPS)
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
-include $(BASEQ2_DEPS)
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
-include $(CTF_DEPS)
2009-03-05 16:34:42 +00:00
# ----------
2009-03-09 16:10:05 +00:00
2010-11-26 12:28:00 +00:00
# release/quake2
release/quake2 : $(CLIENT_OBJS) $(CLIENT_COMMON_OBJS) $(CLIENT_GAME_ABI_OBJS) \
$(UNIX_CLIENT_OBJS) $(SDL_OBJS) $(CLIENT_SERVER_OBJS)
@echo '===> LD $@'
@$(CC) $(LDFLAGS) -o $@ $(CLIENT_OBJS) $(CLIENT_COMMON_OBJS) \
$(CLIENT_GAME_ABI_OBJS) $(UNIX_CLIENT_OBJS) \
$(SDL_OBJS) $(CLIENT_SERVER_OBJS)
# release/q2ded
release/q2ded : $(SERVER_OBJS) $(SERVER_COMMON_OBJS) $(SERVER_GAME_ABI_OBJS) \
$(UNIX_SERVER_OBJS)
@echo '===> LD $@'
@$(CC) $(LDFLAGS) -o $@ $(SERVER_OBJS) $(SERVER_COMMON_OBJS) \
$(SERVER_GAME_ABI_OBJS) $(UNIX_SERVER_OBJS)
# release/ref_gl.so
release/ref_gl.so : $(OPENGL_OBJS) $(OPENGL_GAME_ABI_OBJS) \
$(UNIX_OPENGL_OBJS) $(SDL_OPENGL_OBJS)
@echo '===> LD $@'
@$(CC) $(LDFLAGS) -o $@ $(OPENGL_OBJS) $(OPENGL_GAME_ABI_OBJS) \
$(UNIX_OPENGL_OBJS) $(SDL_OPENGL_OBJS)
# release/bsaeq2/game.so
2009-03-05 16:34:42 +00:00
release/baseq2/game.so : $(BASEQ2_OBJS)
2010-11-26 12:28:00 +00:00
@echo '===> LD $@'
@$(CC) $(LDFLAGS) -o $@ $(BASEQ2_OBJS)
2009-03-05 16:34:42 +00:00
2010-11-26 12:28:00 +00:00
# release/ctf/game.so
2009-03-09 16:10:05 +00:00
release/ctf/game.so : $(CTF_OBJS)
2010-11-26 12:28:00 +00:00
@echo '===> LD $@'
@$(CC) $(LDFLAGS) -o $@ $(CTF_OBJS)
# ----------