forked from sparklewind/RetroArch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
391 lines (327 loc) · 8.24 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
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
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
include config.mk
TARGET = retroarch tools/retroarch-joyconfig
OBJ = retroarch.o \
file.o \
file_path.o \
hash.o \
driver.o \
settings.o \
dynamic.o \
message.o \
rewind.o \
gfx/gfx_common.o \
input/input_common.o \
patch.o \
fifo_buffer.o \
compat/compat.o \
audio/null.o \
gfx/null.o \
input/null.o \
screenshot.o \
gfx/scaler/scaler.o \
gfx/scaler/pixconv.o \
gfx/scaler/scaler_int.o \
gfx/scaler/filter.o \
gfx/image.o \
gfx/fonts/fonts.o \
gfx/fonts/bitmapfont.o \
performance.o
JOYCONFIG_OBJ = tools/retroarch-joyconfig.o \
conf/config_file.o \
file_path.o \
compat/compat.o \
input/input_common.o
HEADERS = $(wildcard */*.h) $(wildcard *.h)
LIBS = -lm
DEFINES = -DHAVE_CONFIG_H -DHAVE_SCREENSHOTS
ifeq ($(REENTRANT_TEST), 1)
DEFINES += -Dmain=retroarch_main
OBJ += console/test.o
endif
ifneq ($(findstring Darwin,$(OS)),)
OSX := 1
LIBS += -framework AppKit
else
OSX := 0
endif
BSD_LOCAL_INC =
DYLIB_LIB = -ldl
ifneq ($(findstring BSD,$(OS)),)
BSD_LOCAL_INC = -I/usr/local/include
DYLIB_LIB = -lc
endif
ifneq ($(findstring Linux,$(OS)),)
LIBS += -lrt
OBJ += input/linuxraw_input.o input/linuxraw_joypad.o
JOYCONFIG_OBJ += input/linuxraw_joypad.o
endif
ifeq ($(HAVE_THREADS), 1)
OBJ += autosave.o thread.o
LIBS += -lpthread
endif
ifeq ($(HAVE_CONFIGFILE), 1)
OBJ += conf/config_file.o
endif
ifeq ($(HAVE_BSV_MOVIE), 1)
OBJ += movie.o
endif
ifeq ($(HAVE_NETPLAY), 1)
OBJ += netplay.o
endif
ifeq ($(HAVE_COMMAND), 1)
OBJ += command.o
endif
ifeq ($(HAVE_RSOUND), 1)
OBJ += audio/rsound.o
LIBS += $(RSOUND_LIBS)
DEFINES += $(RSOUND_CFLAGS)
endif
ifeq ($(HAVE_OSS), 1)
OBJ += audio/oss.o
endif
ifeq ($(HAVE_OSS_BSD), 1)
OBJ += audio/oss.o
endif
ifeq ($(HAVE_OSS_LIB), 1)
LIBS += -lossaudio
endif
ifeq ($(HAVE_ALSA), 1)
OBJ += audio/alsa.o
LIBS += $(ALSA_LIBS)
DEFINES += $(ALSA_CFLAGS)
endif
ifeq ($(HAVE_ROAR), 1)
OBJ += audio/roar.o
LIBS += $(ROAR_LIBS)
DEFINES += $(ROAR_CFLAGS)
endif
ifeq ($(HAVE_AL), 1)
OBJ += audio/openal.o
ifeq ($(OSX),1)
LIBS += -framework OpenAL
else
LIBS += -lopenal
endif
endif
ifeq ($(HAVE_JACK),1)
OBJ += audio/jack.o
LIBS += $(JACK_LIBS)
DEFINES += $(JACK_CFLAGS)
endif
ifeq ($(HAVE_PULSE), 1)
OBJ += audio/pulse.o
LIBS += $(PULSE_LIBS)
DEFINES += $(PULSE_CFLAGS)
endif
ifeq ($(HAVE_COREAUDIO), 1)
OBJ += audio/coreaudio.o
LIBS += -framework CoreServices -framework CoreAudio -framework AudioUnit
endif
ifeq ($(SCALER_NO_SIMD), 1)
DEFINES += -DSCALER_NO_SIMD
endif
ifeq ($(PERF_TEST), 1)
DEFINES += -DPERF_TEST
endif
ifeq ($(HAVE_SDL), 1)
OBJ += gfx/sdl_gfx.o input/sdl_input.o input/sdl_joypad.o audio/sdl_audio.o
JOYCONFIG_OBJ += input/sdl_joypad.o
DEFINES += $(SDL_CFLAGS) $(BSD_LOCAL_INC)
LIBS += $(SDL_LIBS)
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/context/sdl_ctx.o
endif
endif
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/gl.o gfx/gfx_context.o gfx/fonts/gl_font.o gfx/fonts/gl_raster_font.o gfx/math/matrix.o
ifeq ($(HAVE_KMS), 1)
OBJ += gfx/context/drm_egl_ctx.o
DEFINES += $(GBM_CFLAGS) $(DRM_CFLAGS) $(EGL_CFLAGS)
LIBS += $(GBM_LIBS) $(DRM_LIBS) $(EGL_LIBS)
endif
ifeq ($(HAVE_VIDEOCORE), 1)
OBJ += gfx/context/vc_egl_ctx.o
# videocore's libs set later
endif
ifeq ($(HAVE_X11), 1)
ifeq ($(HAVE_GLES), 0)
OBJ += gfx/context/glx_ctx.o
endif
ifeq ($(HAVE_EGL), 1)
OBJ += gfx/context/xegl_ctx.o
DEFINES += $(EGL_CFLAGS)
LIBS += $(EGL_LIBS)
endif
endif
ifeq ($(HAVE_GLES), 1)
LIBS += -lGLESv2
DEFINES += -DHAVE_OPENGLES -DHAVE_OPENGLES2
else
ifeq ($(OSX), 1)
LIBS += -framework OpenGL
else
LIBS += -lGL
endif
endif
endif
ifeq ($(HAVE_VG), 1)
OBJ += gfx/vg.o gfx/math/matrix_3x3.o
DEFINES += $(VG_CFLAGS)
LIBS += $(VG_LIBS)
endif
ifeq ($(HAVE_VIDEOCORE), 1)
LIBS += -lbcm_host -lvcos -lvchiq_arm
endif
ifeq ($(HAVE_XVIDEO), 1)
OBJ += gfx/xvideo.o
LIBS += $(XVIDEO_LIBS)
DEFINES += $(XVIDEO_CFLAGS)
endif
ifeq ($(HAVE_X11), 1)
OBJ += input/x11_input.o gfx/context/x11_common.o
LIBS += $(X11_LIBS) $(XEXT_LIBS) $(XF86VM_LIBS) $(XINERAMA_LIBS)
DEFINES += $(X11_CFLAGS) $(XEXT_CFLAGS) $(XF86VM_CFLAGS) $(XINERAMA_CFLAGS)
endif
ifeq ($(HAVE_CG), 1)
OBJ += gfx/shader_cg.o
ifeq ($(OSX), 1)
LIBS += -framework Cg
else
LIBS += -lCg -lCgGL
endif
endif
ifeq ($(HAVE_XML), 1)
OBJ += cheats.o
LIBS += $(XML_LIBS)
DEFINES += $(XML_CFLAGS)
ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/shader_glsl.o
DEFINES += -DHAVE_GLSL
endif
endif
ifeq ($(HAVE_XML), 1)
OBJ += gfx/state_tracker.o
else ifeq ($(HAVE_CG), 1)
OBJ += gfx/state_tracker.o
endif
ifeq ($(HAVE_DYLIB), 1)
OBJ += gfx/ext_gfx.o audio/ext_audio.o
LIBS += $(DYLIB_LIB)
endif
ifeq ($(HAVE_FREETYPE), 1)
OBJ += gfx/fonts/freetype.o
LIBS += $(FREETYPE_LIBS)
DEFINES += $(FREETYPE_CFLAGS)
endif
ifeq ($(HAVE_SDL_IMAGE), 1)
LIBS += $(SDL_IMAGE_LIBS)
DEFINES += $(SDL_IMAGE_CFLAGS)
endif
ifeq ($(HAVE_LIBPNG), 1)
LIBS += $(LIBPNG_LIBS)
DEFINES += $(LIBPNG_CFLAGS)
endif
ifeq ($(HAVE_FFMPEG), 1)
OBJ += record/ffemu.o
LIBS += $(AVCODEC_LIBS) $(AVFORMAT_LIBS) $(AVUTIL_LIBS) $(SWSCALE_LIBS)
DEFINES += $(AVCODEC_CFLAGS) $(AVFORMAT_CFLAGS) $(AVUTIL_CFLAGS) $(SWSCALE_CFLAGS)
endif
ifeq ($(HAVE_DYNAMIC), 1)
LIBS += $(DYLIB_LIB)
else
LIBS += $(libretro)
endif
ifeq ($(HAVE_PYTHON), 1)
DEFINES += $(PYTHON_CFLAGS) -Wno-unused-parameter
LIBS += $(PYTHON_LIBS)
OBJ += gfx/py_state/py_state.o
endif
ifeq ($(HAVE_SINC), 1)
OBJ += audio/sinc.o
ifeq ($(HAVE_NEON),1)
OBJ += audio/sinc_neon.o
endif
else
OBJ += audio/hermite.o
endif
OBJ += audio/utils.o
ifeq ($(HAVE_NEON),1)
OBJ += audio/utils_neon.o
endif
ifneq ($(V),1)
Q := @
endif
OPTIMIZE_FLAG = -O3
ifeq ($(DEBUG), 1)
OPTIMIZE_FLAG = -O0
endif
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -g -I.
ifeq ($(CXX_BUILD), 1)
LD = $(CXX)
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
else
LD = $(CC)
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
else
CFLAGS += -std=gnu99
endif
endif
ifeq ($(NOUNUSED), yes)
CFLAGS += -Wno-unused-result
endif
all: $(TARGET) config.mk
config.mk: configure qb/*
@echo "config.mk is outdated or non-existing. Run ./configure again."
@exit 1
retroarch: $(OBJ)
$(Q)$(LD) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
@$(if $(Q), $(shell echo echo LD $@),)
tools/retroarch-joyconfig: $(JOYCONFIG_OBJ)
ifeq ($(CXX_BUILD), 1)
$(Q)$(CXX) -o $@ $(JOYCONFIG_OBJ) $(SDL_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
else
$(Q)$(CC) -o $@ $(JOYCONFIG_OBJ) $(SDL_LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
endif
@$(if $(Q), $(shell echo echo LD $@),)
%.o: %.c config.h config.mk $(HEADERS)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -c -o $@ $<
@$(if $(Q), $(shell echo echo CC $<),)
%.o: %.S config.h config.mk $(HEADERS)
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
@$(if $(Q), $(shell echo echo AS $<),)
install: $(TARGET)
mkdir -p $(DESTDIR)$(PREFIX)/bin 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)/etc 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/man/man1 2>/dev/null || /bin/true
mkdir -p $(DESTDIR)$(PREFIX)/share/icons 2>/dev/null || /bin/true
install -m755 $(TARGET) $(DESTDIR)$(PREFIX)/bin
install -m644 retroarch.cfg $(DESTDIR)/etc/retroarch.cfg
install -m644 docs/retroarch.1 $(DESTDIR)$(MAN_DIR)
install -m644 docs/retroarch-joyconfig.1 $(DESTDIR)$(MAN_DIR)
install -m755 retroarch-zip $(DESTDIR)$(PREFIX)/bin
install -m644 media/retroarch.png $(DESTDIR)/usr/share/icons
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-joyconfig
rm -f $(DESTDIR)$(PREFIX)/bin/retroarch-zip
rm -f $(DESTDIR)/etc/retroarch.cfg
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch.1
rm -f $(DESTDIR)$(PREFIX)/share/man/man1/retroarch-joyconfig.1
rm -f $(DESTDIR)/usr/share/icons/retroarch.png
clean:
rm -f *.o
rm -f audio/*.o
rm -f conf/*.o
rm -f gfx/*.o
rm -f gfx/fonts/*.o
rm -f gfx/math/*.o
rm -f gfx/context/*.o
rm -f gfx/py_state/*.o
rm -f gfx/scaler/*.o
rm -f compat/*.o
rm -f record/*.o
rm -f input/*.o
rm -f tools/*.o
rm -f $(TARGET)
.PHONY: all install uninstall clean