forked from smb123w64gb/RSDKv5-Decompilation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
283 lines (222 loc) · 6.23 KB
/
Makefile
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
.DEFAULT_GOAL := all
PKGCONFIG = pkg-config
STRIP ?= strip
STATIC ?= 1
DEBUG ?= 1
VERBOSE ?= 0
PROFILE ?= 0
RSDK_ONLY ?= 0
RETRO_REVISION ?= 3
RSDK_REVISION ?= $(RETRO_REVISION)
ifeq ($(RSDK_REVISION),3)
RSDK_NAME = RSDKv5U
else
RSDK_NAME = RSDKv5
endif
RSDK_SUFFIX =
USERTYPE ?= Dummy
RSDK_CFLAGS =
RSDK_LDFLAGS =
RSDK_LIBS =
RSDK_PREBUILD =
RSDK_PRELINK =
STATICGAME ?= 0
ifeq ($(RSDK_ONLY),0)
GAME_NAME ?= Game
GAME_SUFFIX ?= .so
GAME_ALLC ?= 1
GAME_CFLAGS =
GAME_LDFLAGS = -shared
GAME_LIBS =
GAME_PREBUILD =
GAME_PRELINK =
endif
DEFINES ?=
ifneq ($(AUTOBUILD),)
DEFINES += -DRSDK_AUTOBUILD
endif
# =============================================================================
# Detect default platform if not explicitly specified
# =============================================================================
ifeq ($(OS),Windows_NT)
PLATFORM ?= Windows
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
PLATFORM ?= Linux
endif
ifeq ($(UNAME_S),Darwin)
PLATFORM ?= macOS
endif
endif
PLATFORM ?= Unknown
# =============================================================================
RSDK_SOURCES =
ifneq ("$(wildcard makefiles/$(PLATFORM).cfg)","")
include makefiles/$(PLATFORM).cfg
endif
DEFINES += -DRSDK_USE_$(SUBSYSTEM)
OUTDIR = bin/$(PLATFORM)/$(SUBSYSTEM)
RSDK_OBJDIR = bin/obj/$(PLATFORM)/$(SUBSYSTEM)/RSDKv5
GAME_OBJDIR = bin/obj/$(PLATFORM)/$(GAME_NAME)
# =============================================================================
CFLAGS ?= $(CXXFLAGS)
DEFINES += -DBASE_PATH='"$(BASE_PATH)"'
ifeq ($(DEBUG),1)
CXXFLAGS += -g
CFLAGS += -g
STRIP = :
else
CXXFLAGS += -O3
CFLAGS += -O3
endif
ifeq ($(STATIC),1)
CXXFLAGS += -static
CFLAGS += -static
endif
ifeq ($(PROFILE),1)
CXXFLAGS += -pg -g -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls -fno-default-inline
CFLAGS += -pg -g -fno-inline-functions -fno-inline-functions-called-once -fno-optimize-sibling-calls -fno-default-inline
endif
ifeq ($(VERBOSE),0)
CC := @$(CC)
CXX := @$(CXX)
endif
ifeq ($(STATICGAME),0)
DEFINES += -DRETRO_STANDALONE=1
else
DEFINES += -DRETRO_STANDALONE=0
endif
DEFINES += -DRETRO_REVISION=$(RSDK_REVISION)
ifeq ($(RSDK_REVISION),1)
DEFINES += -DMANIA_PREPLUS=1
endif
CFLAGS_ALL += $(CFLAGS) \
-fsigned-char
CXXFLAGS_ALL += $(CXXFLAGS) \
-std=c++17 \
-fsigned-char \
-fpermissive
LDFLAGS_ALL = $(LDFLAGS)
RSDK_INCLUDES += \
-I./RSDKv5/ \
-I./dependencies/all/ \
-I./dependencies/all/tinyxml2/ \
-I./dependencies/all/iniparser/
# Main Sources
RSDK_SOURCES += \
RSDKv5/main \
RSDKv5/RSDK/Core/RetroEngine \
RSDKv5/RSDK/Core/Math \
RSDKv5/RSDK/Core/Reader \
RSDKv5/RSDK/Core/Link \
RSDKv5/RSDK/Core/ModAPI \
RSDKv5/RSDK/Dev/Debug \
RSDKv5/RSDK/Storage/Storage \
RSDKv5/RSDK/Storage/Text \
RSDKv5/RSDK/Graphics/Drawing \
RSDKv5/RSDK/Graphics/Scene3D \
RSDKv5/RSDK/Graphics/Animation \
RSDKv5/RSDK/Graphics/Sprite \
RSDKv5/RSDK/Graphics/Palette \
RSDKv5/RSDK/Graphics/Video \
RSDKv5/RSDK/Audio/Audio \
RSDKv5/RSDK/Input/Input \
RSDKv5/RSDK/Scene/Scene \
RSDKv5/RSDK/Scene/Collision \
RSDKv5/RSDK/Scene/Object \
RSDKv5/RSDK/Scene/Objects/DefaultObject \
RSDKv5/RSDK/Scene/Objects/DevOutput \
RSDKv5/RSDK/User/Core/UserAchievements \
RSDKv5/RSDK/User/Core/UserCore \
RSDKv5/RSDK/User/Core/UserLeaderboards \
RSDKv5/RSDK/User/Core/UserPresence \
RSDKv5/RSDK/User/Core/UserStats \
RSDKv5/RSDK/User/Core/UserStorage \
dependencies/all/tinyxml2/tinyxml2 \
dependencies/all/iniparser/iniparser \
dependencies/all/iniparser/dictionary \
dependencies/all/miniz/miniz
ifeq ($(RSDK_ONLY),0)
GAME_INCLUDES = \
-I./$(GAME_NAME)/ \
-I./$(GAME_NAME)/Objects/
GAME_SOURCES = \
$(GAME_NAME)/Game
ifeq ($(GAME_ALLC),1)
GAME_SOURCES += $(GAME_NAME)/Objects/All
else
# execute Game/objectmake.py?
include $(GAME_NAME)/Objects.cfg
endif
endif
RSDK_PATH = $(OUTDIR)/$(RSDK_NAME)$(RSDK_SUFFIX)
PKG_NAME ?= $(RSDK_NAME)
PKG_SUFFIX ?= $(RSDK_SUFFIX)
PKG_PATH = $(OUTDIR)/$(PKG_NAME)$(PKG_SUFFIX)
RSDK_OBJECTS += $(addprefix $(RSDK_OBJDIR)/, $(addsuffix .o, $(RSDK_SOURCES)))
$(shell mkdir -p $(OUTDIR))
$(shell mkdir -p $(RSDK_OBJDIR))
ifeq ($(RSDK_ONLY),0)
GAME_OBJECTS += $(addprefix $(GAME_OBJDIR)/, $(addsuffix .o, $(GAME_SOURCES)))
GAME_PATH = $(OUTDIR)/$(GAME_NAME)$(GAME_SUFFIX)
$(shell mkdir -p $(GAME_OBJDIR))
$(GAME_OBJDIR)/%.o: $(GAME_PREBUILD) %.c
@mkdir -p $(@D)
@echo compiling $<...
$(CC) -c -fPIC $(CFLAGS_ALL) $(GAME_FLAGS) $(GAME_INCLUDES) $(DEFINES) $< -o $@
@echo done $<
endif
$(RSDK_OBJDIR)/%.o: %.c
@mkdir -p $(@D)
@echo compiling $<...
$(CC) -c $(CFLAGS_ALL) $(RSDK_CFLAGS) $(RSDK_INCLUDES) $(DEFINES) $< -o $@
@echo done $<
$(RSDK_OBJDIR)/%.o: $(RSDK_PREBUILD) %.cpp
@mkdir -p $(@D)
@echo compiling $<...
$(CXX) -c $(CXXFLAGS_ALL) $(RSDK_CFLAGS) $(RSDK_INCLUDES) $(DEFINES) $< -o $@
@echo done $<
ifeq ($(STATICGAME),1)
$(RSDK_PATH): $(RSDK_PRELINK) $(RSDK_OBJECTS) $(GAME_OBJECTS)
@echo linking...
$(CXX) $(CXXFLAGS_ALL) $(LDFLAGS_ALL) $(RSDK_LDFLAGS) $(RSDK_OBJECTS) $(GAME_OBJECTS) $(RSDK_LIBS) $(GAME_LIBS) -o $@
$(STRIP) $@
@echo done
else # STATICGAME
$(RSDK_PATH): $(RSDK_PRELINK) $(RSDK_OBJECTS)
@echo linking RSDK...
$(CXX) $(CXXFLAGS_ALL) $(LDFLAGS_ALL) $(RSDK_LDFLAGS) $(RSDK_OBJECTS) $(RSDK_LIBS) -o $@
$(STRIP) $@
@echo done linking RSDK
ifeq ($(RSDK_ONLY),0)
$(GAME_PATH): $(GAME_PRELINK) $(GAME_OBJECTS)
@echo linking game...
$(CXX) $(CXXFLAGS_ALL) $(LDFLAGS_ALL) $(GAME_LDFLAGS) $(GAME_OBJECTS) $(GAME_LIBS) -o $@
$(STRIP) $@
@echo done linking game
endif # RSDK_ONLY
endif # STATICGAME
ifeq ($(RSDK_PATH),$(PKG_PATH))
ifeq ($(STATICGAME),1)
all: $(RSDK_PATH)
else # STATICGAME
ifeq ($(RSDK_ONLY),0)
all: $(RSDK_PATH) $(GAME_PATH)
else # RSDK_ONLY
all: $(RSDK_PATH)
endif # RSDK_ONLY
endif # STATICGAME
else # PKGPATH
all: $(PKG_PATH)
endif # PKGPATH
clean-rsdk:
rm -rf $(RSDK_PATH) && rm -rf $(RSDK_OBJDIR)
clean-game:
rm -rf $(GAME_PATH) && rm -rf $(GAME_OBJDIR)
ifeq ($(RSDK_PATH),$(PKG_PATH))
clean: clean-rsdk clean-game
else
clean: clean-rsdk clean-game
rm -rf $(PKG_PATH)
endif