yquake2remaster/Makefile

1011 lines
25 KiB
Makefile
Raw Normal View History

# ------------------------------------------------------ #
# Makefile for the "Yamagi Quake 2 Client" #
# #
# Just type "make" to compile the #
# - SDL Client (quake2) #
# - Server (q2ded) #
# - Quake II Game (baseq2) #
# #
# Base dependencies: #
2013-10-12 10:32:32 +00:00
# - SDL 1.2 or SDL 2.0 #
# - libGL #
# #
# Further dependencies: #
# - libogg #
# - libvorbis #
# - OpenAL #
# - zlib #
# #
# Platforms: #
# - FreeBSD #
# - Linux #
# - OpenBSD #
# - OS X #
2012-06-05 08:37:34 +00:00
# - Windows (MinGW) #
2012-04-29 13:57:33 +00:00
# ------------------------------------------------------ #
# User configurable options
# -------------------------
# Enables CD audio playback. CD audio playback is used
# for the background music and doesn't add any further
# dependencies. It should work on all platforms where
# CD playback is supported by SDL.
WITH_CDA:=yes
# Enables OGG/Vorbis support. OGG/Vorbis files can be
# used as a substitute of CD audio playback. Adds
# dependencies to libogg, libvorbis and libvorbisfile.
WITH_OGG:=yes
# Enables the optional OpenAL sound system.
# To use it your system needs libopenal.so.1
# or openal32.dll (we recommend openal-soft)
# installed
WITH_OPENAL:=yes
# Enables optional runtime loading of OpenAL (dlopen or
# similar). If set to "no", the library is linked in at
# compile time in the normal way. On Windows this option
# is ignored, OpenAL is always loaded at runtime.
DLOPEN_OPENAL:=yes
# Use SDL2 instead of SDL1.2. Disables CD audio support,
# because SDL2 has none. Use OGG/Vorbis music instead :-)
# On Windows sdl-config isn't used, so make sure that
# you've got the SDL2 headers and libs installed.
2013-10-12 09:55:04 +00:00
WITH_SDL2:=yes
# Set the gamma via X11 and not via SDL. This works
# around problems in some SDL version. Adds dependencies
2012-06-05 08:37:34 +00:00
# to pkg-config, libX11 and libXxf86vm. Unsupported on
# Windows and OS X.
WITH_X11GAMMA:=no
2012-06-05 08:37:34 +00:00
# Enables opening of ZIP files (also known as .pk3 paks).
# Adds a dependency to libz
WITH_ZIP:=yes
# Enable systemwide installation of game assets
WITH_SYSTEMWIDE:=no
# This will set the default SYSTEMDIR, a non-empty string
# would actually be used. On Windows normals slashes (/)
# instead of backslashed (\) should be used! The string
# MUST NOT be surrounded by quotation marks!
WITH_SYSTEMDIR:=""
# This will set the architectures of the OSX-binaries.
# You have to make sure your libs/frameworks supports
# these architectures! To build an universal ppc-compatible
# one would add -arch ppc for example.
OSX_ARCH:=-arch $(shell uname -m | sed -e s/i.86/i386/)
# This will set the build options to create an MacOS .app-bundle.
# The app-bundle itself will not be created, but the runtime paths
# will be set to expect the game-data in *.app/
# Contents/Resources
OSX_APP:=yes
# This is an optional configuration file, it'll be used in
# case of presence.
CONFIG_FILE := config.mk
2014-02-26 19:40:17 +00:00
# ----------
# In case a of a configuration file being present, we'll just use it
ifeq ($(wildcard $(CONFIG_FILE)), $(CONFIG_FILE))
include $(CONFIG_FILE)
endif
# Detect the OS
ifdef SystemRoot
YQ2_OSTYPE := Windows
else
YQ2_OSTYPE ?= $(shell uname -s)
endif
# Special case for MinGW
ifneq (,$(findstring MINGW,$(YQ2_OSTYPE)))
YQ2_OSTYPE := Windows
endif
# Detect the architecture
ifeq ($(YQ2_OSTYPE), Windows)
ifdef PROCESSOR_ARCHITEW6432
# 64 bit Windows
YQ2_ARCH ?= $(PROCESSOR_ARCHITEW6432)
else
# 32 bit Windows
YQ2_ARCH ?= $(PROCESSOR_ARCHITECTURE)
endif
else
# Normalize some abiguous YQ2_ARCH strings
YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
endif
# Disable CDA for SDL2
ifeq ($(WITH_SDL2),yes)
ifeq ($(WITH_CDA),yes)
WITH_CDA:=no
# Evil hack to tell the "all" target
# that CDA was disabled because SDL2
# is enabled.
CDA_DISABLED:=yes
endif
endif
# ----------
2012-04-29 13:57:33 +00:00
# Base CFLAGS.
#
# -O2 are enough optimizations.
2012-04-29 13:57:33 +00:00
#
# -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.
#
2012-02-09 17:01:29 +00:00
# -g to build always with debug symbols. Please DO NOT
# CHANGE THIS, since it's our only chance to debug this
# crap when random crashes happen!
#
# -MMD to generate header dependencies. (They cannot be
# generated if building universal binaries on OSX)
ifeq ($(YQ2_OSTYPE), Darwin)
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-Wall -pipe -g -fwrapv
CFLAGS += $(OSX_ARCH)
else
CFLAGS := -std=gnu99 -O2 -fno-strict-aliasing \
-Wall -pipe -g -ggdb -MMD -fwrapv
endif
# ----------
# Defines the operating system and architecture
CFLAGS += -DYQ2OSTYPE=\"$(YQ2_OSTYPE)\" -DYQ2ARCH=\"$(YQ2_ARCH)\"
# ----------
# https://reproducible-builds.org/specs/source-date-epoch/
ifdef SOURCE_DATE_EPOCH
CFLAGS += -DBUILD_DATE=\"$(shell date --utc --date="@${SOURCE_DATE_EPOCH}" +"%b %_d %Y" | sed -e 's/ /\\ /g')\"
endif
# ----------
# Systemwide installation
ifeq ($(WITH_SYSTEMWIDE),yes)
CFLAGS += -DSYSTEMWIDE
ifneq ($(WITH_SYSTEMDIR),"")
CFLAGS += -DSYSTEMDIR=\"$(WITH_SYSTEMDIR)\"
endif
endif
# ----------
# On Windows / MinGW $(CC) is
# undefined by default.
ifeq ($(YQ2_OSTYPE),Windows)
CC := gcc
endif
# ----------
# Extra CFLAGS for SDL
ifeq ($(WITH_SDL2),yes)
SDLCFLAGS := $(shell sdl2-config --cflags)
else # not SDL2
2012-11-05 19:16:35 +00:00
SDLCFLAGS := $(shell sdl-config --cflags)
endif # SDL2
# ----------
2012-04-29 13:57:33 +00:00
# Extra CFLAGS for X11
ifneq ($(YQ2_OSTYPE), Windows)
ifneq ($(YQ2_OSTYPE), Darwin)
ifeq ($(WITH_X11GAMMA),yes)
2012-04-29 13:57:33 +00:00
X11CFLAGS := $(shell pkg-config x11 --cflags)
X11CFLAGS += $(shell pkg-config xxf86vm --cflags)
endif
endif
endif
# ----------
2010-11-26 12:28:00 +00:00
# Base include path.
ifeq ($(YQ2_OSTYPE),Linux)
2010-11-26 12:28:00 +00:00
INCLUDE := -I/usr/include
else ifeq ($(YQ2_OSTYPE),FreeBSD)
2010-11-26 12:28:00 +00:00
INCLUDE := -I/usr/local/include
else ifeq ($(YQ2_OSTYPE),OpenBSD)
2012-08-12 03:59:40 +00:00
INCLUDE := -I/usr/local/include
else ifeq ($(YQ2_OSTYPE),Windows)
INCLUDE := -I/usr/include
2012-04-29 13:57:33 +00:00
endif
2009-04-10 13:11:49 +00:00
# ----------
# Extra includes for GLAD
GLAD_INCLUDE = -Isrc/client/refresh/gl3/glad/include
# ----------
# Base LDFLAGS.
ifeq ($(YQ2_OSTYPE),Linux)
LDFLAGS := -L/usr/lib -lm -ldl -rdynamic
else ifeq ($(YQ2_OSTYPE),FreeBSD)
2010-11-26 12:28:00 +00:00
LDFLAGS := -L/usr/local/lib -lm
else ifeq ($(YQ2_OSTYPE),OpenBSD)
2012-08-12 03:59:40 +00:00
LDFLAGS := -L/usr/local/lib -lm
else ifeq ($(YQ2_OSTYPE),Windows)
LDFLAGS := -L/usr/lib -lws2_32 -lwinmm -static-libgcc
else ifeq ($(YQ2_OSTYPE), Darwin)
LDFLAGS := $(OSX_ARCH) -lm
2012-04-29 13:57:33 +00:00
endif
CFLAGS += -fvisibility=hidden
2016-12-21 19:21:36 +00:00
LDFLAGS += -fvisibility=hidden
ifneq ($(YQ2_OSTYPE), Darwin)
2016-12-21 19:21:36 +00:00
# for some reason the OSX linker doesn't support this
LDFLAGS += -Wl,--no-undefined
endif
# ----------
# Extra LDFLAGS for SDL
ifeq ($(YQ2_OSTYPE), Darwin)
ifeq ($(WITH_SDL2),yes)
2017-01-31 16:51:46 +00:00
SDLLDFLAGS := -lSDL2
else # not SDL2
SDLLDFLAGS := -lSDL -framework OpenGL -framework Cocoa
endif # SDL2
else # not Darwin
ifeq ($(WITH_SDL2),yes)
SDLLDFLAGS := $(shell sdl2-config --libs)
else # not SDL2
SDLLDFLAGS := $(shell sdl-config --libs)
endif # SDL2
endif # Darwin
# ----------
2012-04-29 13:57:33 +00:00
# Extra LDFLAGS for X11
ifneq ($(YQ2_OSTYPE), Windows)
ifneq ($(YQ2_OSTYPE), Darwin)
ifeq ($(WITH_X11GAMMA),yes)
2012-04-29 13:57:33 +00:00
X11LDFLAGS := $(shell pkg-config x11 --libs)
X11LDFLAGS += $(shell pkg-config xxf86vm --libs)
2013-08-27 19:54:48 +00:00
X11LDFLAGS += $(shell pkg-config xrandr --libs)
endif
endif
endif
# ----------
# When make is invoked by "make VERBOSE=1" print
# the compiler and linker commands.
ifdef VERBOSE
Q :=
else
Q := @
2012-04-29 13:57:33 +00:00
endif
# ----------
# Phony targets
2017-04-02 14:23:00 +00:00
.PHONY : all client game icon server ref_gl1 ref_gl3
# ----------
2010-11-26 12:28:00 +00:00
# Builds everything
2017-04-02 14:23:00 +00:00
all: config client server game ref_gl1 ref_gl3
# ----------
# Print config values
config:
@echo "Build configuration"
@echo "============================"
@echo "WITH_CDA = $(WITH_CDA)"
@echo "WITH_OPENAL = $(WITH_OPENAL)"
@echo "WITH_SDL2 = $(WITH_SDL2)"
@echo "WITH_X11GAMMA = $(WITH_X11GAMMA)"
@echo "WITH_ZIP = $(WITH_ZIP)"
@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
@echo "============================"
@echo ""
ifeq ($(WITH_SDL2),yes)
ifeq ($(CDA_DISABLED),yes)
@echo "WARNING: CDA disabled because SDL2 doesn't support it!"
@echo ""
endif
endif
# ----------
# Special target to compile
# the icon on Windows
ifeq ($(YQ2_OSTYPE), Windows)
icon:
@echo "===> WR build/icon/icon.res"
2014-02-08 09:08:20 +00:00
${Q}mkdir -p build/icon
${Q}windres src/backends/windows/icon.rc -O COFF -o build/icon/icon.res
endif
# ----------
2010-11-26 12:28:00 +00:00
# Cleanup
clean:
@echo "===> CLEAN"
${Q}rm -Rf build release/*
cleanall:
2010-11-26 12:28:00 +00:00
@echo "===> CLEAN"
${Q}rm -Rf build release
2012-04-29 13:57:33 +00:00
2009-03-05 11:28:58 +00:00
# ----------
2012-04-29 13:57:33 +00:00
# The client
ifeq ($(YQ2_OSTYPE), Windows)
client:
@echo "===> Building quake2.exe"
${Q}mkdir -p release
$(MAKE) release/quake2.exe
build/client/%.o: %.c
@echo "===> CC $<"
2014-02-08 09:08:20 +00:00
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(WITH_CDA),yes)
release/quake2.exe : CFLAGS += -DCDA
endif
ifeq ($(WITH_OGG),yes)
release/quake2.exe : CFLAGS += -DOGG
release/quake2.exe : LDFLAGS += -lvorbisfile -lvorbis -logg
endif
ifeq ($(WITH_OPENAL),yes)
release/quake2.exe : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"openal32.dll"' -DDLOPEN_OPENAL
endif
ifeq ($(WITH_ZIP),yes)
release/quake2.exe : CFLAGS += -DZIP -DNOUNCRYPT
release/quake2.exe : LDFLAGS += -lz
endif
2012-06-05 09:02:48 +00:00
ifeq ($(WITH_SDL2),yes)
release/quake2.exe : CFLAGS += -DSDL2
endif
release/quake2.exe : LDFLAGS += -mwindows
else # not Windows
2010-11-26 12:28:00 +00:00
client:
@echo "===> Building quake2"
${Q}mkdir -p release
2012-04-29 13:57:33 +00:00
$(MAKE) release/quake2
2010-11-26 12:28:00 +00:00
build/client/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(YQ2_OSTYPE), Darwin)
build/client/%.o : %.m
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) $(OSX_ARCH) -x objective-c -c $< -o $@
endif
release/quake2 : CFLAGS += -Wno-unused-result
ifeq ($(WITH_CDA),yes)
release/quake2 : CFLAGS += -DCDA
endif
ifeq ($(WITH_OGG),yes)
release/quake2 : CFLAGS += -DOGG
release/quake2 : LDFLAGS += -lvorbis -lvorbisfile -logg
endif
ifeq ($(WITH_OPENAL),yes)
ifeq ($(DLOPEN_OPENAL),yes)
ifeq ($(YQ2_OSTYPE), OpenBSD)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"' -DDLOPEN_OPENAL
else ifeq ($(YQ2_OSTYPE), Darwin)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.dylib"' -I/usr/local/opt/openal-soft/include -DDLOPEN_OPENAL
release/quake2 : LDFLAGS += -L/usr/local/opt/openal-soft/lib
2012-08-12 03:59:40 +00:00
else
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"' -DDLOPEN_OPENAL
2012-08-12 03:59:40 +00:00
endif
else # !DLOPEN_OPENAL
release/quake2 : CFLAGS += -DUSE_OPENAL -I/usr/local/opt/openal-soft/include
release/quake2 : LDFLAGS += -lopenal -L/usr/local/opt/openal-soft/lib
endif # !DLOPEN_OPENAL
endif # WITH_OPENAL
ifeq ($(WITH_ZIP),yes)
release/quake2 : CFLAGS += -DZIP -DNOUNCRYPT
release/quake2 : LDFLAGS += -lz
endif
ifeq ($(WITH_X11GAMMA),yes)
release/quake2 : CFLAGS += -DX11GAMMA
endif
ifeq ($(WITH_SDL2),yes)
release/quake2 : CFLAGS += -DSDL2
endif
ifneq ($(YQ2_OSTYPE), Darwin)
2017-04-02 14:23:00 +00:00
release/ref_gl1.so : LDFLAGS += -lGL
endif
ifeq ($(YQ2_OSTYPE), FreeBSD)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$$ORIGIN/lib'
else ifeq ($(YQ2_OSTYPE), Linux)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$$ORIGIN/lib'
endif
ifeq ($(WITH_SYSTEMWIDE),yes)
ifneq ($(WITH_SYSTEMDIR),"")
ifeq ($(YQ2_OSTYPE), FreeBSD)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$(WITH_SYSTEMDIR)/lib'
else ifeq ($(YQ2_OSTYPE), Linux)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='$(WITH_SYSTEMDIR)/lib'
endif
else
ifeq ($(YQ2_OSTYPE), FreeBSD)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='/usr/share/games/quake2/lib'
else ifeq ($(YQ2_OSTYPE), Linux)
release/quake2 : LDFLAGS += -Wl,-z,origin,-rpath='/usr/share/games/quake2/lib'
endif
endif
endif
endif
# ----------
2010-11-26 12:28:00 +00:00
# The server
ifeq ($(YQ2_OSTYPE), Windows)
2010-11-26 12:28:00 +00:00
server:
@echo "===> Building q2ded"
${Q}mkdir -p release
$(MAKE) release/q2ded.exe
build/server/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/q2ded.exe : CFLAGS += -DDEDICATED_ONLY
release/q2ded.exe : LDFLAGS += -lz
ifeq ($(WITH_ZIP),yes)
release/q2ded.exe : CFLAGS += -DZIP -DNOUNCRYPT
release/q2ded.exe : LDFLAGS += -lz
endif
else # not Windows
server:
@echo "===> Building q2ded"
${Q}mkdir -p release
2010-11-26 12:28:00 +00:00
$(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 $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
2009-03-05 16:34:42 +00:00
release/q2ded : CFLAGS += -DDEDICATED_ONLY -Wno-unused-result
2009-03-09 16:10:05 +00:00
ifeq ($(WITH_ZIP),yes)
release/q2ded : CFLAGS += -DZIP -DNOUNCRYPT
release/q2ded : LDFLAGS += -lz
endif
endif
# ----------
# The OpenGL 1.x renderer lib
ifeq ($(YQ2_OSTYPE), Windows)
2017-04-02 14:23:00 +00:00
ref_gl1:
@echo "===> Building ref_gl1.dll"
$(MAKE) release/ref_gl1.dll
ifeq ($(WITH_SDL2),yes)
2017-04-02 14:23:00 +00:00
release/ref_gl1.dll : CFLAGS += -DSDL2
endif
2017-04-02 14:23:00 +00:00
release/ref_gl1.dll : LDFLAGS += -lopengl32 -shared
# don't want the dll to link against libSDL2main or libmingw32, and no -mwindows either
# that's for the .exe only
DLL_SDLLDFLAGS = $(subst -mwindows,,$(subst -lmingw32,,$(subst -lSDL2main,,$(SDLLDFLAGS))))
else ifeq ($(YQ2_OSTYPE), Darwin)
2017-04-02 14:23:00 +00:00
ref_gl1:
@echo "===> Building ref_gl1.dylib"
$(MAKE) release/ref_gl1.dylib
ifeq ($(WITH_SDL2),yes)
2017-04-02 14:23:00 +00:00
release/ref_gl1.dylib : CFLAGS += -DSDL2
endif
2017-04-02 14:23:00 +00:00
release/ref_gl1.dylib : LDFLAGS += -shared -framework OpenGL
2016-12-21 19:21:36 +00:00
else # not Windows or Darwin
2017-04-02 14:23:00 +00:00
ref_gl1:
@echo "===> Building ref_gl1.so"
$(MAKE) release/ref_gl1.so
2017-04-02 14:23:00 +00:00
release/ref_gl1.so : CFLAGS += -fPIC
release/ref_gl1.so : LDFLAGS += -shared
ifeq ($(WITH_SDL2),yes)
2017-04-02 14:23:00 +00:00
release/ref_gl1.so : CFLAGS += -DSDL2
endif
2017-04-02 14:23:00 +00:00
endif # OS specific ref_gl1 shit
2017-04-02 14:23:00 +00:00
build/ref_gl1/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(X11CFLAGS) $(INCLUDE) -o $@ $<
# ----------
# The OpenGL 3.x renderer lib
ifeq ($(YQ2_OSTYPE), Windows)
ref_gl3:
@echo "===> Building ref_gl3.dll"
$(MAKE) release/ref_gl3.dll
ifeq ($(WITH_SDL2),yes)
release/ref_gl3.dll : CFLAGS += -DSDL2
endif
release/ref_gl3.dll : LDFLAGS += -shared
else ifeq ($(YQ2_OSTYPE), Darwin)
ref_gl3:
@echo "===> Building ref_gl3.dylib"
$(MAKE) release/ref_gl3.dylib
ifeq ($(WITH_SDL2),yes)
release/ref_gl3.dylib : CFLAGS += -DSDL2
endif
2017-01-31 16:51:46 +00:00
release/ref_gl3.dylib : LDFLAGS += -shared
else # not Windows or Darwin
ref_gl3:
@echo "===> Building ref_gl3.so"
$(MAKE) release/ref_gl3.so
release/ref_gl3.so : CFLAGS += -fPIC
release/ref_gl3.so : LDFLAGS += -shared
ifeq ($(WITH_SDL2),yes)
release/ref_gl3.so : CFLAGS += -DSDL2
endif
endif # OS specific ref_gl3 shit
build/ref_gl3/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) $(GLAD_INCLUDE) -o $@ $<
2009-03-09 16:10:05 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# The baseq2 game
ifeq ($(YQ2_OSTYPE), Windows)
game:
@echo "===> Building baseq2/game.dll"
${Q}mkdir -p release/baseq2
$(MAKE) release/baseq2/game.dll
build/baseq2/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/baseq2/game.dll : LDFLAGS += -shared
else ifeq ($(YQ2_OSTYPE), Darwin)
game:
@echo "===> Building baseq2/game.dylib"
${Q}mkdir -p release/baseq2
$(MAKE) release/baseq2/game.dylib
build/baseq2/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/baseq2/game.dylib : CFLAGS += -fPIC
release/baseq2/game.dylib : LDFLAGS += -shared
else # not Windows or Darwin
game:
@echo "===> Building baseq2/game.so"
${Q}mkdir -p release/baseq2
2010-11-26 12:28:00 +00:00
$(MAKE) release/baseq2/game.so
2010-11-26 12:28:00 +00:00
build/baseq2/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/baseq2/game.so : CFLAGS += -fPIC -Wno-unused-result
2010-11-26 12:28:00 +00:00
release/baseq2/game.so : LDFLAGS += -shared
endif
2009-03-03 14:10:08 +00:00
# ----------
# Used by the game
GAME_OBJS_ = \
src/common/shared/flash.o \
src/common/shared/rand.o \
src/common/shared/shared.o \
2012-11-05 19:16:35 +00:00
src/game/g_ai.o \
src/game/g_chase.o \
src/game/g_cmds.o \
src/game/g_combat.o \
src/game/g_func.o \
src/game/g_items.o \
src/game/g_main.o \
src/game/g_misc.o \
src/game/g_monster.o \
src/game/g_phys.o \
src/game/g_spawn.o \
src/game/g_svcmds.o \
src/game/g_target.o \
src/game/g_trigger.o \
src/game/g_turret.o \
src/game/g_utils.o \
src/game/g_weapon.o \
src/game/monster/berserker/berserker.o \
src/game/monster/boss2/boss2.o \
src/game/monster/boss3/boss3.o \
src/game/monster/boss3/boss31.o \
src/game/monster/boss3/boss32.o \
src/game/monster/brain/brain.o \
src/game/monster/chick/chick.o \
src/game/monster/flipper/flipper.o \
src/game/monster/float/float.o \
src/game/monster/flyer/flyer.o \
src/game/monster/gladiator/gladiator.o \
src/game/monster/gunner/gunner.o \
src/game/monster/hover/hover.o \
src/game/monster/infantry/infantry.o \
src/game/monster/insane/insane.o \
src/game/monster/medic/medic.o \
src/game/monster/misc/move.o \
src/game/monster/mutant/mutant.o \
src/game/monster/parasite/parasite.o \
src/game/monster/soldier/soldier.o \
src/game/monster/supertank/supertank.o \
src/game/monster/tank/tank.o \
src/game/player/client.o \
src/game/player/hud.o \
src/game/player/trail.o \
src/game/player/view.o \
src/game/player/weapon.o \
2012-11-05 19:16:35 +00:00
src/game/savegame/savegame.o
2012-04-29 13:57:33 +00:00
2009-04-10 13:11:49 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Used by the client
CLIENT_OBJS_ := \
src/backends/generic/misc.o \
src/backends/generic/qal.o \
2012-11-05 19:16:35 +00:00
src/backends/generic/vid.o \
2012-08-01 11:47:32 +00:00
src/backends/sdl/cd.o \
src/backends/sdl/input.o \
src/backends/sdl/refresh.o \
2012-08-01 11:47:32 +00:00
src/backends/sdl/sound.o \
2010-11-26 12:28:00 +00:00
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/ogg.o \
2013-04-21 09:18:32 +00:00
src/client/sound/openal.o \
src/client/sound/sound.o \
src/client/sound/wave.o \
src/common/argproc.o \
src/common/clientserver.o \
src/common/collision.o \
2010-11-26 12:28:00 +00:00
src/common/crc.o \
src/common/cmdparser.o \
2010-11-26 12:28:00 +00:00
src/common/cvar.o \
src/common/filesystem.o \
src/common/glob.o \
2010-11-26 12:28:00 +00:00
src/common/md4.o \
src/common/movemsg.o \
2010-11-26 12:28:00 +00:00
src/common/misc.o \
src/common/netchan.o \
src/common/pmove.o \
src/common/szone.o \
src/common/zone.o \
src/common/shared/flash.o \
src/common/shared/rand.o \
src/common/shared/shared.o \
2010-11-26 12:28:00 +00:00
src/common/unzip/ioapi.o \
src/common/unzip/unzip.o \
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
ifeq ($(YQ2_OSTYPE), Windows)
CLIENT_OBJS_ += \
src/backends/windows/network.o \
2012-11-06 19:47:13 +00:00
src/backends/windows/system.o \
src/backends/windows/shared/mem.o
else
CLIENT_OBJS_ += \
2012-08-01 11:58:10 +00:00
src/backends/unix/main.o \
2012-11-05 19:16:35 +00:00
src/backends/unix/network.o \
src/backends/unix/signalhandler.o \
2012-11-06 19:47:13 +00:00
src/backends/unix/system.o \
src/backends/unix/shared/hunk.o
endif
# ----------
REFGL1_OBJS_ := \
src/client/refresh/gl/qgl.o \
src/client/refresh/gl/r_draw.o \
src/client/refresh/gl/r_image.o \
src/client/refresh/gl/r_light.o \
src/client/refresh/gl/r_lightmap.o \
src/client/refresh/gl/r_main.o \
src/client/refresh/gl/r_mesh.o \
src/client/refresh/gl/r_misc.o \
src/client/refresh/gl/r_model.o \
src/client/refresh/gl/r_scrap.o \
src/client/refresh/gl/r_surf.o \
src/client/refresh/gl/r_warp.o \
src/client/refresh/gl/r_sdl.o \
src/client/refresh/gl/r_md2.o \
src/client/refresh/gl/r_sp2.o \
src/client/refresh/files/pcx.o \
src/client/refresh/files/stb.o \
src/client/refresh/files/wal.o \
src/common/shared/shared.o
ifeq ($(YQ2_OSTYPE), Windows)
REFGL1_OBJS_ += \
src/backends/windows/shared/mem.o
else # not Windows
REFGL1_OBJS_ += \
src/backends/unix/shared/hunk.o
endif
# ----------
REFGL3_OBJS_ := \
src/client/refresh/gl3/gl3_draw.o \
src/client/refresh/gl3/gl3_image.o \
src/client/refresh/gl3/gl3_light.o \
src/client/refresh/gl3/gl3_lightmap.o \
src/client/refresh/gl3/gl3_main.o \
src/client/refresh/gl3/gl3_mesh.o \
src/client/refresh/gl3/gl3_misc.o \
src/client/refresh/gl3/gl3_model.o \
src/client/refresh/gl3/gl3_sdl.o \
src/client/refresh/gl3/gl3_surf.o \
src/client/refresh/gl3/gl3_warp.o \
src/client/refresh/gl3/gl3_shaders.o \
src/client/refresh/gl3/gl3_md2.o \
src/client/refresh/gl3/gl3_sp2.o \
src/client/refresh/gl3/glad/src/glad.o \
src/client/refresh/files/pcx.o \
src/client/refresh/files/stb.o \
src/client/refresh/files/wal.o \
src/common/shared/shared.o
ifeq ($(YQ2_OSTYPE), Windows)
REFGL3_OBJS_ += \
src/backends/windows/shared/mem.o
else # not Windows
REFGL3_OBJS_ += \
src/backends/unix/shared/hunk.o
endif
# ----------
# Used by the server
SERVER_OBJS_ := \
src/common/argproc.o \
src/common/clientserver.o \
src/common/collision.o \
src/common/crc.o \
src/common/cmdparser.o \
src/common/cvar.o \
src/common/filesystem.o \
src/common/glob.o \
src/common/md4.o \
src/common/misc.o \
src/common/movemsg.o \
src/common/netchan.o \
src/common/pmove.o \
src/common/szone.o \
src/common/zone.o \
src/common/shared/rand.o \
src/common/shared/shared.o \
src/common/unzip/ioapi.o \
src/common/unzip/unzip.o \
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 \
src/backends/generic/misc.o
ifeq ($(YQ2_OSTYPE), Windows)
SERVER_OBJS_ += \
src/backends/windows/network.o \
2012-11-06 19:47:13 +00:00
src/backends/windows/system.o \
src/backends/windows/shared/mem.o
else # not Windows
SERVER_OBJS_ += \
2012-08-01 11:58:10 +00:00
src/backends/unix/main.o \
2012-11-05 19:16:35 +00:00
src/backends/unix/network.o \
src/backends/unix/signalhandler.o \
2012-11-06 19:47:13 +00:00
src/backends/unix/system.o \
src/backends/unix/shared/hunk.o
endif
2012-04-29 13:57:33 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Rewrite pathes to our object directory
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
REFGL1_OBJS = $(patsubst %,build/ref_gl1/%,$(REFGL1_OBJS_))
REFGL3_OBJS = $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_))
2010-11-26 12:28:00 +00:00
SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_))
GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
2010-09-01 08:58:58 +00:00
# ----------
2010-11-26 12:28:00 +00:00
# Generate header dependencies
2012-04-29 13:57:33 +00:00
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
REFGL1_DEPS= $(REFGL1_OBJS:.o=.d)
REFGL3_DEPS= $(REFGL3_OBJS:.o=.d)
2012-04-29 13:57:33 +00:00
SERVER_DEPS= $(SERVER_OBJS:.o=.d)
GAME_DEPS= $(GAME_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
2012-04-29 13:57:33 +00:00
-include $(CLIENT_DEPS)
-include $(REFGL1_DEPS)
-include $(REFGL3_DEPS)
2012-04-29 13:57:33 +00:00
-include $(SERVER_DEPS)
-include $(GAME_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
ifeq ($(YQ2_OSTYPE), Windows)
release/quake2.exe : $(CLIENT_OBJS) icon
@echo "===> LD $@"
${Q}$(CC) build/icon/icon.res $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
$(Q)strip $@
else
release/quake2 : $(CLIENT_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) $(X11LDFLAGS) -o $@
endif
2010-11-26 12:28:00 +00:00
# release/q2ded
ifeq ($(YQ2_OSTYPE), Windows)
release/q2ded.exe : $(SERVER_OBJS) icon
@echo "===> LD $@.exe"
${Q}$(CC) build/icon/icon.res $(SERVER_OBJS) $(LDFLAGS) -o $@
$(Q)strip $@
else
release/q2ded : $(SERVER_OBJS)
@echo "===> LD $@"
2011-12-26 08:48:33 +00:00
${Q}$(CC) $(SERVER_OBJS) $(LDFLAGS) -o $@
endif
2010-11-26 12:28:00 +00:00
2017-04-02 14:23:00 +00:00
# release/ref_gl1.so
ifeq ($(YQ2_OSTYPE), Windows)
release/ref_gl1.dll : $(REFGL1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL1_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@
$(Q)strip $@
else ifeq ($(YQ2_OSTYPE), Darwin)
release/ref_gl1.dylib : $(REFGL1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL1_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
else
release/ref_gl1.so : $(REFGL1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL1_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
endif
# release/ref_gl3.so
ifeq ($(YQ2_OSTYPE), Windows)
release/ref_gl3.dll : $(REFGL3_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@
$(Q)strip $@
else ifeq ($(YQ2_OSTYPE), Darwin)
release/ref_gl3.dylib : $(REFGL3_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
else
release/ref_gl3.so : $(REFGL3_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
endif
# release/baseq2/game.so
ifeq ($(YQ2_OSTYPE), Windows)
release/baseq2/game.dll : $(GAME_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(GAME_OBJS) $(LDFLAGS) -o $@
$(Q)strip $@
else ifeq ($(YQ2_OSTYPE), Darwin)
release/baseq2/game.dylib : $(GAME_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(GAME_OBJS) $(LDFLAGS) -o $@
else
release/baseq2/game.so : $(GAME_OBJS)
@echo "===> LD $@"
2011-12-26 08:48:33 +00:00
${Q}$(CC) $(GAME_OBJS) $(LDFLAGS) -o $@
endif
2010-11-26 12:28:00 +00:00
# ----------