/
Makefile.in
366 lines (279 loc) · 8.68 KB
/
Makefile.in
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
##
# MegaZeux Makefile fragment
##
include contrib/gdm2s3m/src/Makefile.in
include contrib/icons/Makefile.in
include contrib/libmodplug/src/Makefile.in
.PHONY: mzx_clean core_target_clean
LINK_CC := ${CC}
core_src = src
core_obj = src/.build
network_src = src/network
network_obj = src/network/.build
core_flags += -ffast-math -funsigned-char
core_flags += -Wmissing-format-attribute -Wpointer-arith
core_flags += -Wwrite-strings
core_cflags += ${CFLAGS} -Wmissing-prototypes
core_cxxflags = ${CXXFLAGS} -DHAVE_INTTYPES_H
core_flags += -I${core_src} -I${PREFIX}/include
core_ldflags := -lm ${core_ldflags}
ifeq (${PLATFORM},mingw)
core_spec := -DCORE_LIBSPEC="__declspec(dllexport)"
endif
${core_obj}/main.o: ${core_src}/main.c
$(if ${V},,@echo " CC " $<)
${CC} -MD ${core_cflags} ${core_flags} -c $< -o $@
${core_obj}/run_stubs.o: ${core_src}/run_stubs.c
$(if ${V},,@echo " CC " $<)
${CC} -MD ${core_cflags} ${core_flags} -c $< -o $@
${core_obj}/updater.o: ${core_src}/updater.c
$(if ${V},,@echo " CC " $<)
${CC} -MD ${core_cflags} ${core_flags} -c $< -o $@
${network_obj}/%.o: ${network_src}/%.c
$(if ${V},,@echo " CC " $<)
${CC} -MD ${core_cflags} ${core_flags} ${core_spec} -c $< -o $@
${core_obj}/%.o: ${core_src}/%.c
$(if ${V},,@echo " CC " $<)
${CC} -MD ${core_cflags} ${core_flags} ${core_spec} -c $< -o $@
${core_obj}/%.o: ${core_src}/%.cpp
$(if ${V},,@echo " CXX " $<)
${CXX} -MD ${core_cxxflags} ${core_flags} ${core_spec} -c $< -o $@
#
# Lists mandatory C language sources (mangled to object names) required
# to build the main binary. Please keep this sorted alphabetically.
#
core_cobjs := \
${core_obj}/board.o ${core_obj}/configure.o ${core_obj}/counter.o \
${core_obj}/data.o ${core_obj}/error.o ${core_obj}/event.o \
${core_obj}/expr.o ${core_obj}/fsafeopen.o ${core_obj}/game2.o \
${core_obj}/game.o ${core_obj}/graphics.o ${core_obj}/idarray.o \
${core_obj}/idput.o ${core_obj}/intake.o ${core_obj}/legacy_rasm.o \
${core_obj}/mzm.o ${core_obj}/render.o ${core_obj}/robot.o \
${core_obj}/run_robot.o ${core_obj}/scrdisp.o ${core_obj}/sfx.o \
${core_obj}/sprite.o ${core_obj}/util.o ${core_obj}/validation.o \
${core_obj}/window.o ${core_obj}/world.o
#
# Lists mandatory C++ language sources (mangled to object names) required
# to build the main binary. Currently there are only optional sources.
#
core_cxxobjs :=
#
# Hack to avoid silly warnings from devkitPro headers
#
ifeq ($(or ${BUILD_WII},${BUILD_NDS},${BUILD_PSP}),)
core_cflags += -Wstrict-prototypes
endif
#
# Hack to avoid silly warnings from Android headers
#
ifeq (${PLATFORM},android)
core_cflags += -Wno-strict-prototypes
endif
#
# These are really just hacks and should be moved elsewhere
#
ifeq (${BUILD_NDS},1)
core_cobjs += arch/nds/ram.o arch/nds/exception.o
core_cobjs += arch/nds/dlmalloc.o
core_cobjs += arch/nds/platform.o arch/nds/event.o
core_cobjs += arch/nds/render.o arch/nds/evq.o
ifneq (${BUILD_DEBYTECODE},1)
core_cobjs += arch/nds/extmem.o
endif
endif
ifeq (${PLATFORM},android)
core_cxxobjs += arch/android/sfwrapper.o
LINK_CC := ${CXX}
endif
ifeq (${BUILD_WII},1)
core_cobjs += arch/wii/event.o arch/wii/platform.o
ifeq (${BUILD_AUDIO},1)
core_cobjs += arch/wii/audio.o
endif
endif
#
# Other modular stuff
#
ifeq (${BUILD_HELPSYS},1)
core_cobjs += ${core_obj}/helpsys.o
endif
ifeq (${BUILD_RENDER_SOFT},1)
core_cobjs += ${core_obj}/render_soft.o
endif
# GL shared
ifneq ($(or ${BUILD_RENDER_GL_FIXED},${BUILD_RENDER_GL_PROGRAM}),)
core_cobjs += ${core_obj}/render_gl.o
endif
# Fixed function renderers (OGL=1, OGLES=1)
ifeq (${BUILD_RENDER_GL_FIXED},1)
core_cobjs += ${core_obj}/render_gl1.o ${core_obj}/render_gl2.o
endif
# Shader renderers (OGL>=2, OGLES=2)
ifeq (${BUILD_RENDER_GL_PROGRAM},1)
core_cobjs += ${core_obj}/render_glsl.o
endif
#
# Currently only usable with GL, but could theoretically be used
# with OpenVG in the future.
#
ifeq (${BUILD_EGL},1)
core_cobjs += ${core_obj}/render_egl.o
core_ldflags := -lEGL ${core_ldflags}
ifneq (${X11DIR},)
core_flags += -I${X11DIR}/../include
core_ldflags := -L${X11DIR}/../${RAWLIBDIR} -lX11 ${core_ldflags}
endif
endif
ifeq (${BUILD_RENDER_YUV},1)
core_cobjs += ${core_obj}/render_yuv.o
core_cobjs += ${core_obj}/render_yuv1.o ${core_obj}/render_yuv2.o
endif
ifeq (${BUILD_RENDER_GP2X},1)
core_cobjs += ${core_obj}/render_gp2x.o
endif
ifeq (${BUILD_RENDER_GX},1)
core_cobjs += ${core_obj}/render_gx.o
endif
ifeq (${BUILD_MODPLUG},1)
core_cflags += -I${gdm2s3m_src}
core_cobjs += ${gdm2s3m_objs}
core_flags += -I${libmodplug_src} -I${libmodplug_src}/libmodplug
core_cxxobjs += ${core_obj}/audio_modplug.o ${libmodplug_objs}
LINK_CC := ${CXX}
endif
ifeq (${BUILD_MIKMOD},1)
core_ldflags := ${MIKMOD_LDFLAGS} ${core_ldflags}
core_cobjs += ${core_obj}/audio_mikmod.o
endif
ifeq (${LIBPNG},1)
core_flags += ${LIBPNG_CFLAGS} -DNEED_PNG_WRITE_SCREEN
core_ldflags := ${LIBPNG_LDFLAGS} ${core_ldflags}
core_cobjs += ${core_obj}/pngops.o
endif
ifeq (${BUILD_AUDIO},1)
core_cobjs += ${core_obj}/audio.o
core_flags += ${VORBIS_CFLAGS}
core_ldflags := ${VORBIS_LDFLAGS} ${core_ldflags}
endif
ifeq (${BUILD_SDL},1)
core_cobjs += ${core_obj}/event_sdl.o ${core_obj}/platform_sdl.o
core_cobjs += ${core_obj}/render_sdl.o
ifeq (${BUILD_AUDIO},1)
core_cobjs += ${core_obj}/audio_sdl.o
endif
core_flags += ${SDL_CFLAGS}
core_ldflags += ${SDL_LDFLAGS}
ifeq (${BUILD_MODULAR},1)
mzx_ldflags += ${SDL_LDFLAGS}
mzxrun_ldflags += ${SDL_LDFLAGS}
endif
else
ifeq ($(or ${BUILD_WII},${BUILD_NDS}),)
core_cobjs += ${core_obj}/platform_dummy.o
#
# Normally SDL would provide us with pthread, but in the case
# we're not using SDL or any other platform mutex implementation,
# we must link pthread ourselves.
#
ifeq (${PTHREAD},1)
core_ldflags := ${PTHREAD_LDFLAGS} ${core_ldflags}
endif
endif
endif
ifeq (${BUILD_NETWORK},1)
core_cflags += ${ZLIB_CFLAGS}
core_ldflags := ${ZLIB_LDFLAGS} ${core_ldflags}
core_cobjs += ${network_obj}/host.o ${network_obj}/manifest.o
core_cobjs += ${network_obj}/network.o ${network_obj}/sha256.o
ifeq (${BUILD_UPDATER},1)
mzx_objs += ${core_obj}/updater.o
endif
ifeq (${PLATFORM},amiga)
core_ldflags := ${core_ldflags} -lnet
endif
endif
ifeq (${BUILD_DEBYTECODE},1)
core_cobjs += ${core_obj}/rasm.o
endif
core_objs := ${core_cobjs} ${core_cxxobjs}
-include ${core_objs:.o=.d}
${core_objs}: $(filter-out $(wildcard ${core_obj}), ${core_obj})
${core_objs}: $(filter-out $(wildcard ${network_obj}), ${network_obj})
ifeq (${BUILD_MODULAR},1)
core_target := ${DSOPRE}core${DSOPOST}
${core_target}: ${core_objs}
$(if ${V},,@echo " LINK " $@)
${LINK_CC} ${DSOLDFLAGS} -o $@ ${core_objs} ${LDFLAGS} \
${DSOSONAME}$@ ${core_ldflags}
core_target_clean:
$(if ${V},,@echo " RM " ${core_target} ${core_target}.debug)
${RM} ${core_target} ${core_target}.debug
else
core_target := ${core_objs}
core_target_clean:
endif
ifeq (${BUILD_EDITOR},1)
include src/editor/Makefile.in
mzx_objs := ${mzx_objs} ${core_obj}/main.o
ifeq (${PLATFORM},darwin)
mzx_objs += arch/darwin/SDLMain.o
mzx_ldflags += -framework Cocoa
endif
-include ${mzx_objs:.o=.d}
ifeq (${EMBED_ICONS},1)
mzx_objs += ${icons}
endif
ifeq (${BUILD_MODULAR},1)
${mzx}.debug: ${core_target}.debug ${editor_target}.debug
endif
${mzx}: ${core_target} ${editor_target} ${mzx_objs}
$(if ${V},,@echo " LINK " ${mzx})
ifeq (${BUILD_MODULAR},1)
${CC} ${mzx_objs} -o ${mzx} ${ARCH_EXE_LDFLAGS} ${LDFLAGS} \
${DSORPATH} -L. -lcore -leditor \
${mzx_ldflags}
else
${LINK_CC} ${mzx_objs} ${core_target} ${editor_target} \
-o ${mzx} ${ARCH_EXE_LDFLAGS} ${LDFLAGS} \
${core_ldflags} ${editor_ldflags}
endif
mzx_clean: editor_clean
else
.PHONY: ${mzx}.debug
${mzx}:
${mzx}.debug:
endif
ifeq (${BUILD_MZXRUN},1)
mzxrun_objs := ${core_obj}/main.o ${core_obj}/run_stubs.o
ifeq (${PLATFORM},darwin)
mzxrun_objs += arch/darwin/SDLMain.o
mzxrun_ldflags += -framework Cocoa
endif
-include ${mzxrun_objs:.o=.d}
ifeq (${EMBED_ICONS},1)
mzxrun_objs += ${icons}
endif
ifeq (${BUILD_MODULAR},1)
${mzxrun}.debug: ${core_target}.debug
endif
${mzxrun}: ${core_target} ${mzxrun_objs}
$(if ${V},,@echo " LINK " ${mzxrun})
ifeq (${BUILD_MODULAR},1)
${CC} ${mzxrun_objs} -o ${mzxrun} ${ARCH_EXE_LDFLAGS} ${LDFLAGS} \
${DSORPATH} -L. -lcore ${mzxrun_ldflags}
else
${LINK_CC} ${mzxrun_objs} ${core_target} \
-o ${mzxrun} ${ARCH_EXE_LDFLAGS} ${LDFLAGS} ${core_ldflags}
endif
else
.PHONY: ${mzxrun}.debug
${mzxrun}:
${mzxrun}.debug:
endif
mzx_clean: core_target_clean gdm2s3m_clean icons_clean libmodplug_clean
$(if ${V},,@echo " RM " ${core_obj} ${network_obj})
${RM} -r ${core_obj} ${network_obj}
$(if ${V},,@echo " RM " ${mzxrun} ${mzxrun}.debug)
${RM} ${mzxrun} ${mzxrun}.debug
$(if ${V},,@echo " RM " ${mzx} ${mzx}.debug)
${RM} ${mzx} ${mzx}.debug