forked from CaravelGames/drod
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig
More file actions
163 lines (139 loc) · 6.54 KB
/
Copy pathConfig
File metadata and controls
163 lines (139 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#######################################
### DROD macOS Build Configuration ###
#######################################
#
# Modern macOS build: Apple Clang + Homebrew, vendored into a self-contained
# .app by build_macos.sh. Builds native arm64 by default; pass UNIVERSAL_BUILD=1
# for a universal (x86_64 + arm64) binary.
#
# Index:
# <1> Architecture & compiler flags
# <2> Library locations (Homebrew + in-tree metakit)
# <3> Per-module include flags
# <4> Linker flags
# <5> System programs
###########################################
### <1> Architecture & compiler flags ###
###########################################
ifdef UNIVERSAL_BUILD
ARCH_FLAGS = -arch x86_64 -arch arm64
else
ARCH_FLAGS = -arch arm64
endif
# Deployment target. The third-party dependencies are built from source for this
# same target (see build_deps.sh), so the .app genuinely runs on macOS >= this.
MACOSX_VERSION_MIN = 15.0
# Flags always applied. Architecture, deployment target and the C++ standard go
# here (not in CXXFLAGS) so they survive the make recursion. -std=c++11 makes
# BackEndLib/PortsBase.h define USE_CXX11, selecting the native char16_t WCHAR
# path (no ext/pod_char_traits.h hack needed).
CXXFLAGS_common = -W -Wall -g -std=c++11 $(ARCH_FLAGS) -mmacosx-version-min=$(MACOSX_VERSION_MIN)
# Per-build-type optimization flags.
CXXFLAGS_custom = -Wno-unused -pipe -O2 -fomit-frame-pointer -ffast-math
CXXFLAGS_release = -Wno-unused -pipe -O2 -fomit-frame-pointer -ffast-math
CXXFLAGS_debug = -Wno-unused -pipe -ggdb -D_DEBUG -ffast-math
# Steam build: optimized + STEAMBUILD, with the Steamworks SDK headers.
# STEAM_SDK must point at an unpacked Steamworks SDK (so $(STEAM_SDK)/public/steam
# contains steam_api.h); pass it on the make command line or via build_macos.sh.
# STEAM_TSS=1 selects the TSS app (adds STEAMBUILD_TSS_APP -> drod-tss5_0.dat);
# leaving it unset builds GatEB (default drod5_0.dat).
STEAM_SDK ?=
STEAM_TSS ?=
STEAM_DEFINES = -DSTEAMBUILD $(if $(STEAM_TSS),-DSTEAMBUILD_TSS_APP)
CXXFLAGS_steam = $(CXXFLAGS_custom) $(STEAM_DEFINES) -I$(STEAM_SDK)/public/steam
# Linker flags always applied (architecture + deployment target).
LDFLAGS = $(ARCH_FLAGS) -mmacosx-version-min=$(MACOSX_VERSION_MIN)
# Standalone game selection. The TSS engine builds several older games from the
# same source, each gated behind a compile-time define (see wszUniqueResFile /
# GAMETITLE in DROD/Main.cpp and GetOfficialHoldStatus in DRODLib/DbHolds.cpp).
# Pass GAME=<kdd|jtrh|tcb|gateb> on the make command line (or via build_macos.sh
# --game) to build that standalone game; leaving it unset builds plain TSS.
GAME ?=
GAME_DEFINE = \
$(if $(filter kdd,$(GAME)),-DKDD_STANDALONE) \
$(if $(filter jtrh,$(GAME)),-DJTRH_STANDALONE) \
$(if $(filter tcb,$(GAME)),-DTCB_STANDALONE) \
$(if $(filter gateb,$(GAME)),-DGATEB_STANDALONE)
# Build variant selection.
VARIANT_FLAGS = -DUSE_SDL_MIXER -DCARAVELBUILD $(GAME_DEFINE)
###########################################
### <2> Library locations ###
###########################################
# All third-party dependencies are built from source as universal dylibs (and
# metakit as a static lib) into this prefix by build_deps.sh.
DEPS = $(SRCDIR)/Master/Darwin/deps
SDL_INCLUDE = -I$(DEPS)/include/SDL2 -D_THREAD_SAFE
SDL_TTF_INCLUDE = -I$(DEPS)/include/SDL2
SDL_MIXER_INCLUDE = -I$(DEPS)/include/SDL2
PNG_INCLUDE = -I$(DEPS)/include
JPEG_INCLUDE = -I$(DEPS)/include
EXPAT_INCLUDE = -I$(DEPS)/include
OGG_INCLUDE = -I$(DEPS)/include
VORBIS_INCLUDE = -I$(DEPS)/include
THEORA_INCLUDE = -I$(DEPS)/include
JSON_INCLUDE = -I$(DEPS)/include
# Metakit: headers from the in-tree submodule, static lib from the deps prefix.
METAKIT_INCLUDE = -I$(SRCDIR)/metakit/include
METAKIT_LIB = $(DEPS)/lib/libmk4.a
###########################################
### <3> Per-module include flags ###
###########################################
CPPFLAGS_BackEndLib = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(SDL_INCLUDE) $(JSON_INCLUDE)
CPPFLAGS_CaravelNet = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(EXPAT_INCLUDE) $(SDL_INCLUDE) $(JSON_INCLUDE)
CPPFLAGS_DRODLib = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(EXPAT_INCLUDE) $(SDL_INCLUDE) $(JSON_INCLUDE)
CPPFLAGS_FrontEndLib = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(PNG_INCLUDE) $(JPEG_INCLUDE) $(EXPAT_INCLUDE) \
$(SDL_INCLUDE) $(JSON_INCLUDE) $(SDL_TTF_INCLUDE) $(OGG_INCLUDE) $(VORBIS_INCLUDE) \
$(THEORA_INCLUDE) $(SDL_MIXER_INCLUDE)
CPPFLAGS_DROD = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(PNG_INCLUDE) $(JPEG_INCLUDE) $(EXPAT_INCLUDE) \
$(SDL_INCLUDE) $(JSON_INCLUDE) $(SDL_TTF_INCLUDE) $(SDL_MIXER_INCLUDE)
CPPFLAGS_DRODUtil = $(VARIANT_FLAGS) $(METAKIT_INCLUDE) $(EXPAT_INCLUDE) $(SDL_INCLUDE) $(JSON_INCLUDE) \
$(SDL_TTF_INCLUDE) $(SDL_MIXER_INCLUDE)
###########################################
### <4> Linker flags ###
###########################################
# System libraries (curl, zlib) and frameworks. -rpath points at the bundle's
# Frameworks dir so the vendored dylibs are found at runtime.
OTHER_LIBS = -lcurl -lz \
-framework AudioToolbox -framework AudioUnit -framework Cocoa -framework OpenGL \
-headerpad_max_install_names
# Single dynamic link line: metakit (static) + the from-source universal dylibs.
LDFLAGS_DROD_custom = \
$(LDFLAGS) \
$(METAKIT_LIB) \
-L$(DEPS)/lib \
-lexpat -lSDL2_mixer -lvorbisfile -lvorbis -logg -ltheora \
-lSDL2_ttf -lfreetype -lSDL2 -lpng16 -ljpeg -ljsoncpp \
-Wl,-rpath,@executable_path/../Frameworks/ \
$(OTHER_LIBS)
LDFLAGS_DROD_release = -Wl,-s $(LDFLAGS_DROD_custom)
LDFLAGS_DROD_debug = $(LDFLAGS_DROD_custom)
# Steam: same as custom plus the Steam API (libsteam_api.dylib is staged into
# $(DEPS)/lib by build_macos.sh so -L$(DEPS)/lib finds it and it gets vendored).
LDFLAGS_DROD_steam = $(LDFLAGS_DROD_custom) -lsteam_api
# drodutil links the same set (it pulls in the same module archives).
LDFLAGS_UTIL_custom = $(LDFLAGS_DROD_custom)
LDFLAGS_UTIL_release = $(LDFLAGS_DROD_release)
LDFLAGS_UTIL_debug = $(LDFLAGS_DROD_debug)
LDFLAGS_UTIL_steam = $(LDFLAGS_DROD_steam)
###########################################
### <5> System programs ###
###########################################
CC = clang
CXX = clang++
# Compile and generate dependencies in one operation.
CXXDEP = $(CXX) -MD
DEPOUT = -MF
LD = $(CXX)
AR = ar cr
RANLIB = ranlib
GREP = grep
SED = sed -e
MKDIR = mkdir -p
RM_F = rm -f
RM_RF = rm -rf
ECHO = echo
# Top source directory (relative to Master/Darwin).
SRCDIR = ../..
# Executable names.
DROD = drod
DRODUTIL = drodutil