cdrom-async: Fix subchannel read with hardware CD-ROM
[pcsx_rearmed.git] / Makefile
... / ...
CommitLineData
1# Makefile for PCSX ReARMed
2
3# default stuff goes here, so that config can override
4TARGET ?= pcsx
5CFLAGS += -Wall -Iinclude -ffast-math
6
7DEBUG ?= 0
8DEBUG_SYMS ?= 0
9ASSERTS ?= 0
10HAVE_CHD ?= 1
11ifneq ($(DEBUG)$(DEBUG_SYMS), 00)
12CFLAGS += -ggdb
13endif
14ifneq ($(DEBUG), 1)
15CFLAGS += -O3
16ifneq ($(ASSERTS), 1)
17CFLAGS += -DNDEBUG
18endif
19endif
20ifeq ($(DEBUG_ASAN), 1)
21CFLAGS += -fsanitize=address
22LDFLAGS += -fsanitize=address
23#LDFLAGS += -static-libasan
24endif
25ifeq ($(DEBUG_UBSAN), 1)
26CFLAGS += -fsanitize=undefined -fno-sanitize=shift-base
27LDFLAGS += -fsanitize=undefined
28endif
29#DRC_DBG = 1
30#PCNT = 1
31
32# Suppress minor warnings for dependencies
33deps/%: CFLAGS += -Wno-unused -Wno-unused-function
34
35all: config.mak target_ plugins_
36
37ifndef NO_CONFIG_MAK
38ifneq ($(wildcard config.mak),)
39config.mak: ./configure
40 @echo $@ is out-of-date, running configure
41 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
42include config.mak
43else
44config.mak:
45 @echo "Please run ./configure before running make!"
46 @exit 1
47endif
48else # NO_CONFIG_MAK
49config.mak:
50endif
51
52-include Makefile.local
53
54CC_LINK ?= $(CC)
55CC_AS ?= $(CC)
56LDFLAGS += $(MAIN_LDFLAGS)
57#EXTRA_LDFLAGS ?= -Wl,-Map=$@.map # not on some linkers
58LDLIBS += $(MAIN_LDLIBS)
59ifdef PCNT
60CFLAGS += -DPCNT
61endif
62
63ifneq ($(NO_FSECTIONS), 1)
64CFLAGS += -ffunction-sections -fdata-sections
65ifeq ($(GNU_LINKER),1)
66FSECTIONS_LDFLAGS ?= -Wl,--gc-sections
67LDFLAGS += $(FSECTIONS_LDFLAGS)
68endif
69endif # NO_FSECTIONS
70CFLAGS += -DP_HAVE_MMAP=$(if $(NO_MMAP),0,1) \
71 -DP_HAVE_PTHREAD=$(if $(NO_PTHREAD),0,1) \
72 -DP_HAVE_POSIX_MEMALIGN=$(if $(NO_POSIX_MEMALIGN),0,1) \
73 -DDISABLE_MEM_LUTS=0
74CXXFLAGS += $(CFLAGS)
75
76# core
77OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cdrom-async.o \
78 libpcsxcore/cheat.o libpcsxcore/database.o \
79 libpcsxcore/decode_xa.o libpcsxcore/mdec.o \
80 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
81 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o \
82 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o \
83 libpcsxcore/psxevents.o libpcsxcore/r3000a.o \
84 libpcsxcore/sio.o libpcsxcore/spu.o libpcsxcore/gpu.o
85OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
86#OBJS += libpcsxcore/debug.o libpcsxcore/socket.o libpcsxcore/disr3000a.o
87
88ifeq ($(WANT_ZLIB),1)
89ZLIB_DIR = deps/libchdr/deps/zlib-1.3.1
90CFLAGS += -I$(ZLIB_DIR)
91OBJS += $(ZLIB_DIR)/adler32.o \
92 $(ZLIB_DIR)/compress.o \
93 $(ZLIB_DIR)/crc32.o \
94 $(ZLIB_DIR)/deflate.o \
95 $(ZLIB_DIR)/gzclose.o \
96 $(ZLIB_DIR)/gzlib.o \
97 $(ZLIB_DIR)/gzread.o \
98 $(ZLIB_DIR)/gzwrite.o \
99 $(ZLIB_DIR)/infback.o \
100 $(ZLIB_DIR)/inffast.o \
101 $(ZLIB_DIR)/inflate.o \
102 $(ZLIB_DIR)/inftrees.o \
103 $(ZLIB_DIR)/trees.o \
104 $(ZLIB_DIR)/uncompr.o \
105 $(ZLIB_DIR)/zutil.o
106$(ZLIB_DIR)/%.o: CFLAGS += -DHAVE_UNISTD_H
107endif
108
109ifeq "$(ARCH)" "arm"
110OBJS += libpcsxcore/gte_arm.o
111endif
112ifeq "$(HAVE_NEON_ASM)" "1"
113OBJS += libpcsxcore/gte_neon.o
114endif
115libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
116
117ifeq ($(MMAP_WIN32),1)
118CFLAGS += -Iinclude/mman -Ideps/mman
119OBJS += deps/mman/mman.o
120endif
121ifeq "$(USE_ASYNC_CDROM)" "1"
122libpcsxcore/cdrom-async.o: CFLAGS += -DUSE_ASYNC_CDROM
123frontend/libretro.o: CFLAGS += -DUSE_ASYNC_CDROM
124frontend/menu.o: CFLAGS += -DUSE_ASYNC_CDROM
125USE_RTHREADS := 1
126endif
127
128# dynarec
129ifeq "$(DYNAREC)" "lightrec"
130CFLAGS += -Ideps/lightning/include -Ideps/lightrec -Iinclude/lightning -Iinclude/lightrec \
131 -DLIGHTREC -DLIGHTREC_STATIC
132ifeq ($(LIGHTREC_DEBUG),1)
133deps/lightrec/%.o: CFLAGS += -DLOG_LEVEL=DEBUG_L
134libpcsxcore/lightrec/plugin.o: CFLAGS += -DLIGHTREC_DEBUG=1
135frontend/main.o: CFLAGS += -DLIGHTREC_DEBUG=1
136deps/lightning/%.o: CFLAGS += -DDISASSEMBLER=1 -DBINUTILS_2_38=1 -DBINUTILS_2_29=1 \
137 -DHAVE_DISASSEMBLE_INIT_FOR_TARGET=1 -DPACKAGE_VERSION=1
138LDFLAGS += -lopcodes -lbfd
139endif
140LIGHTREC_CUSTOM_MAP ?= 0
141LIGHTREC_CUSTOM_MAP_OBJ ?= libpcsxcore/lightrec/mem.o
142LIGHTREC_THREADED_COMPILER ?= 0
143LIGHTREC_CODE_INV ?= 0
144CFLAGS += -DLIGHTREC_CUSTOM_MAP=$(LIGHTREC_CUSTOM_MAP) \
145 -DLIGHTREC_CODE_INV=$(LIGHTREC_CODE_INV) \
146 -DLIGHTREC_ENABLE_THREADED_COMPILER=$(LIGHTREC_THREADED_COMPILER) \
147 -DLIGHTREC_ENABLE_DISASSEMBLER=$(or $(LIGHTREC_DEBUG),0) \
148 -DLIGHTREC_NO_DEBUG=$(if $(LIGHTREC_DEBUG),0,1)
149ifeq ($(LIGHTREC_CUSTOM_MAP),1)
150LDLIBS += -lrt
151OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ)
152endif
153ifeq ($(NEED_SYSCONF),1)
154OBJS += libpcsxcore/lightrec/sysconf.o
155endif
156ifeq ($(LIGHTREC_THREADED_COMPILER),1)
157OBJS += deps/lightrec/recompiler.o \
158 deps/lightrec/reaper.o
159endif
160OBJS += deps/lightrec/tlsf/tlsf.o
161OBJS += libpcsxcore/lightrec/plugin.o
162OBJS += deps/lightning/lib/jit_disasm.o \
163 deps/lightning/lib/jit_memory.o \
164 deps/lightning/lib/jit_names.o \
165 deps/lightning/lib/jit_note.o \
166 deps/lightning/lib/jit_print.o \
167 deps/lightning/lib/jit_size.o \
168 deps/lightning/lib/lightning.o \
169 deps/lightrec/blockcache.o \
170 deps/lightrec/constprop.o \
171 deps/lightrec/disassembler.o \
172 deps/lightrec/emitter.o \
173 deps/lightrec/interpreter.o \
174 deps/lightrec/lightrec.o \
175 deps/lightrec/memmanager.o \
176 deps/lightrec/optimizer.o \
177 deps/lightrec/regcache.o
178deps/lightning/%.o: CFLAGS += -DHAVE_MMAP=P_HAVE_MMAP
179deps/lightning/%: CFLAGS += -Wno-uninitialized
180deps/lightrec/%: CFLAGS += -Wno-uninitialized
181libpcsxcore/lightrec/mem.o: CFLAGS += -D_GNU_SOURCE
182ifeq ($(MMAP_WIN32),1)
183deps/lightning/lib/lightning.o: CFLAGS += -Dmprotect=_mprotect # deps/mman
184deps/lightning/lib/jit_print.o: CFLAGS += -w
185endif
186else ifeq "$(DYNAREC)" "ari64"
187OBJS += libpcsxcore/new_dynarec/new_dynarec.o
188OBJS += libpcsxcore/new_dynarec/pcsxmem.o
189 ifeq "$(ARCH)" "arm"
190 OBJS += libpcsxcore/new_dynarec/linkage_arm.o
191 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c
192 else ifneq (,$(findstring $(ARCH),aarch64 arm64))
193 OBJS += libpcsxcore/new_dynarec/linkage_arm64.o
194 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm64.c
195 else
196 $(error no dynarec support for architecture $(ARCH))
197 endif
198 ifeq "$(NDRC_THREAD)" "1"
199 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -DNDRC_THREAD
200 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DNDRC_THREAD
201 frontend/libretro.o: CFLAGS += -DNDRC_THREAD
202 USE_RTHREADS := 1
203 endif
204else
205CFLAGS += -DDRC_DISABLE
206endif
207OBJS += libpcsxcore/new_dynarec/emu_if.o
208libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/pcsxmem_inline.c
209ifdef DRC_DBG
210libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
211CFLAGS += -DDRC_DBG
212endif
213ifeq "$(BASE_ADDR_DYNAMIC)" "1"
214libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_DYNAMIC=1
215endif
216
217# spu
218OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
219 plugins/dfsound/registers.o plugins/dfsound/spu.o \
220 plugins/dfsound/out.o plugins/dfsound/nullsnd.o
221plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
222 plugins/dfsound/xa.c
223ifeq "$(ARCH)" "arm"
224OBJS += plugins/dfsound/arm_utils.o
225endif
226ifeq "$(HAVE_C64_TOOLS)" "1"
227plugins/dfsound/%.o: CFLAGS += -DC64X_DSP -DWANT_THREAD_CODE
228plugins/dfsound/spu.o: plugins/dfsound/spu_c64x.c
229frontend/menu.o: CFLAGS += -DC64X_DSP
230endif
231ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
232plugins/dfsound/out.o: CFLAGS += -DHAVE_OSS
233OBJS += plugins/dfsound/oss.o
234endif
235ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
236plugins/dfsound/out.o: CFLAGS += -DHAVE_ALSA
237OBJS += plugins/dfsound/alsa.o
238LDLIBS += -lasound
239endif
240ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
241plugins/dfsound/out.o: CFLAGS += -DHAVE_SDL
242OBJS += plugins/dfsound/sdl.o
243endif
244ifneq ($(findstring pulseaudio,$(SOUND_DRIVERS)),)
245plugins/dfsound/out.o: CFLAGS += -DHAVE_PULSE
246OBJS += plugins/dfsound/pulseaudio.o
247endif
248ifneq ($(findstring libretro,$(SOUND_DRIVERS)),)
249plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
250endif
251
252# supported gpu list in menu
253ifeq "$(HAVE_NEON_GPU)" "1"
254frontend/menu.o: CFLAGS += -DGPU_NEON
255endif
256ifeq "$(HAVE_GLES)" "1"
257frontend/menu.o: CFLAGS += -DHAVE_GLES
258endif
259
260# builtin gpu
261OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o plugins/gpulib/prim.o
262ifeq "$(BUILTIN_GPU)" "neon"
263CFLAGS += -DGPU_NEON
264OBJS += plugins/gpu_neon/psx_gpu_if.o
265plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
266plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
267frontend/menu.o frontend/plugin_lib.o: CFLAGS += -DBUILTIN_GPU_NEON
268 ifeq "$(HAVE_NEON_ASM)" "1"
269 OBJS += plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
270 else
271 OBJS += plugins/gpu_neon/psx_gpu/psx_gpu_simd.o
272 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DSIMD_BUILD
273 plugins/gpu_neon/psx_gpu/psx_gpu_simd.o: CFLAGS += -DSIMD_BUILD
274 endif
275endif
276ifeq "$(BUILTIN_GPU)" "peops"
277CFLAGS += -DGPU_PEOPS
278# note: code is not safe for strict-aliasing? (Castlevania problems)
279plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
280plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
281frontend/menu.o frontend/plugin_lib.o: CFLAGS += -DBUILTIN_GPU_PEOPS
282OBJS += plugins/dfxvideo/gpulib_if.o
283ifeq "$(THREAD_RENDERING)" "1"
284CFLAGS += -DTHREAD_RENDERING
285OBJS += plugins/gpulib/gpulib_thread_if.o
286endif
287endif
288
289ifeq "$(BUILTIN_GPU)" "unai"
290CFLAGS += -DGPU_UNAI
291CFLAGS += -DUSE_GPULIB=1
292OBJS += plugins/gpu_unai/gpulib_if.o
293ifeq "$(ARCH)" "arm"
294OBJS += plugins/gpu_unai/gpu_arm.o
295endif
296ifeq "$(THREAD_RENDERING)" "1"
297CFLAGS += -DTHREAD_RENDERING
298OBJS += plugins/gpulib/gpulib_thread_if.o
299endif
300ifneq "$(GPU_UNAI_NO_OLD)" "1"
301OBJS += plugins/gpu_unai/old/if.o
302else
303CFLAGS += -DGPU_UNAI_NO_OLD
304endif
305plugins/gpu_unai/gpulib_if.o: plugins/gpu_unai/*.h
306plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -DUSE_GPULIB=1
307frontend/menu.o frontend/plugin_lib.o: CFLAGS += -DBUILTIN_GPU_UNAI
308ifneq ($(DEBUG), 1)
309plugins/gpu_unai/gpulib_if.o \
310plugins/gpu_unai/old/if.o: CFLAGS += -O3
311endif
312CC_LINK = $(CXX)
313endif
314
315# libchdr
316ifeq "$(HAVE_CHD)" "1"
317LCHDR = deps/libchdr
318LCHDR_LZMA = $(LCHDR)/deps/lzma-24.05
319LCHDR_ZSTD = $(LCHDR)/deps/zstd-1.5.6/lib
320OBJS += $(LCHDR)/src/libchdr_bitstream.o
321OBJS += $(LCHDR)/src/libchdr_cdrom.o
322OBJS += $(LCHDR)/src/libchdr_chd.o
323OBJS += $(LCHDR)/src/libchdr_flac.o
324OBJS += $(LCHDR)/src/libchdr_huffman.o
325$(LCHDR)/src/%.o: CFLAGS += -Wno-unused -Wno-maybe-uninitialized -std=gnu11
326OBJS += $(LCHDR_LZMA)/src/Alloc.o
327OBJS += $(LCHDR_LZMA)/src/CpuArch.o
328OBJS += $(LCHDR_LZMA)/src/Delta.o
329OBJS += $(LCHDR_LZMA)/src/LzFind.o
330OBJS += $(LCHDR_LZMA)/src/LzmaDec.o
331OBJS += $(LCHDR_LZMA)/src/LzmaEnc.o
332OBJS += $(LCHDR_LZMA)/src/Sort.o
333$(LCHDR_LZMA)/src/%.o: CFLAGS += -Wno-unused -DZ7_ST -I$(LCHDR_LZMA)/include
334$(LCHDR)/src/%.o: CFLAGS += -I$(LCHDR_LZMA)/include
335OBJS += $(LCHDR_ZSTD)/common/entropy_common.o
336OBJS += $(LCHDR_ZSTD)/common/error_private.o
337OBJS += $(LCHDR_ZSTD)/common/fse_decompress.o
338OBJS += $(LCHDR_ZSTD)/common/xxhash.o
339OBJS += $(LCHDR_ZSTD)/common/zstd_common.o
340OBJS += $(LCHDR_ZSTD)/decompress/huf_decompress.o
341OBJS += $(LCHDR_ZSTD)/decompress/huf_decompress_amd64.o
342OBJS += $(LCHDR_ZSTD)/decompress/zstd_ddict.o
343OBJS += $(LCHDR_ZSTD)/decompress/zstd_decompress_block.o
344OBJS += $(LCHDR_ZSTD)/decompress/zstd_decompress.o
345$(LCHDR_ZSTD)/common/%.o \
346$(LCHDR_ZSTD)/decompress/%.o: CFLAGS += -I$(LCHDR_ZSTD)
347$(LCHDR)/src/%.o: CFLAGS += -I$(LCHDR_ZSTD)
348libpcsxcore/cdriso.o: CFLAGS += -Wno-unused-function
349CFLAGS += -DHAVE_CHD -I$(LCHDR)/include
350endif
351
352# frontend/gui
353OBJS += frontend/cspace.o
354ifeq "$(HAVE_NEON_ASM)" "1"
355OBJS += frontend/cspace_neon.o
356frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565 -DHAVE_bgr888_to_x
357else
358ifeq "$(ARCH)" "arm"
359OBJS += frontend/cspace_arm.o
360frontend/cspace.o: CFLAGS += -DHAVE_bgr555_to_rgb565
361endif
362endif
363
364ifeq "$(PLATFORM)" "generic"
365OBJS += frontend/libpicofe/in_sdl.o
366#OBJS += frontend/libpicofe/plat_sdl.o
367OBJS += frontend/libpicofe/plat_dummy.o
368OBJS += frontend/plat_sdl.o
369frontend/plat_sdl.o frontend/libpicofe/plat_sdl.o: CFLAGS += -DSDL_OVERLAY_2X
370frontend/menu.o: CFLAGS += -DSDL_OVERLAY_2X -DMENU_SHOW_VARSCALER=1
371ifeq "$(HAVE_EVDEV)" "1"
372OBJS += frontend/libpicofe/linux/in_evdev.o
373endif
374ifeq "$(HAVE_GLES)" "1"
375OBJS += frontend/libpicofe/gl.o frontend/libpicofe/gl_platform.o
376OBJS += frontend/libpicofe/gl_loader.o
377#LDLIBS += $(LDLIBS_GLES) # loaded dynamically now
378frontend/libpicofe/plat_sdl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
379frontend/libpicofe/gl_platform.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
380frontend/libpicofe/gl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
381frontend/plat_sdl.o: CFLAGS += -DHAVE_GLES $(CFLAGS_GLES)
382endif
383USE_PLUGIN_LIB = 1
384USE_FRONTEND = 1
385endif
386ifeq "$(PLATFORM)" "pandora"
387OBJS += frontend/libpicofe/pandora/plat.o
388OBJS += frontend/libpicofe/linux/fbdev.o frontend/libpicofe/linux/xenv.o
389OBJS += frontend/libpicofe/linux/in_evdev.o
390OBJS += frontend/plat_pandora.o frontend/plat_omap.o
391frontend/main.o frontend/menu.o: CFLAGS += -include frontend/pandora/ui_feat.h
392frontend/main.o frontend/plugin_lib.o: CFLAGS += -DPANDORA
393frontend/libpicofe/linux/plat.o: CFLAGS += -DPANDORA
394USE_PLUGIN_LIB = 1
395USE_FRONTEND = 1
396CFLAGS += -gdwarf-3
397endif
398ifeq "$(PLATFORM)" "caanoo"
399OBJS += frontend/libpicofe/gp2x/in_gp2x.o frontend/warm/warm.o
400OBJS += frontend/libpicofe/gp2x/soc_pollux.o
401OBJS += frontend/libpicofe/linux/in_evdev.o
402OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
403frontend/main.o frontend/menu.o: CFLAGS += -include frontend/320240/ui_gp2x.h
404USE_PLUGIN_LIB = 1
405USE_FRONTEND = 1
406endif
407ifeq "$(PLATFORM)" "miyoo"
408HOMEPATH = /mnt
409OBJS += frontend/libpicofe/in_sdl.o
410OBJS += frontend/libpicofe/linux/in_evdev.o
411OBJS += frontend/libpicofe/plat_dummy.o
412OBJS += frontend/plat_sdl.o
413frontend/main.o frontend/menu.o: CFLAGS += -include frontend/320240/ui_miyoo.h
414USE_PLUGIN_LIB = 1
415USE_FRONTEND = 1
416endif
417ifeq "$(PLATFORM)" "maemo"
418OBJS += maemo/hildon.o maemo/main.o maemo/maemo_xkb.o frontend/pl_gun_ts.o
419maemo/%.o: maemo/%.c
420USE_PLUGIN_LIB = 1
421LDFLAGS += $(shell pkg-config --libs hildon-1 libpulse)
422CFLAGS += $(shell pkg-config --cflags hildon-1) -DHAVE_TSLIB
423CFLAGS += `pkg-config --cflags glib-2.0 libosso dbus-1 hildon-fm-2`
424LDFLAGS += `pkg-config --libs glib-2.0 libosso dbus-1 hildon-fm-2`
425endif
426ifeq "$(PLATFORM)" "libretro"
427ifneq "$(HAVE_PHYSICAL_CDROM)$(USE_LIBRETRO_VFS)" "00"
428OBJS += deps/libretro-common/compat/compat_strl.o
429OBJS += deps/libretro-common/file/file_path.o
430OBJS += deps/libretro-common/string/stdstring.o
431OBJS += deps/libretro-common/vfs/vfs_implementation.o
432endif
433ifeq "$(HAVE_PHYSICAL_CDROM)" "1"
434OBJS += frontend/libretro-cdrom.o
435OBJS += deps/libretro-common/lists/string_list.o
436OBJS += deps/libretro-common/memmap/memalign.o
437OBJS += deps/libretro-common/vfs/vfs_implementation_cdrom.o
438CFLAGS += -DHAVE_CDROM
439endif
440ifeq "$(USE_LIBRETRO_VFS)" "1"
441OBJS += deps/libretro-common/compat/compat_posix_string.o
442OBJS += deps/libretro-common/compat/fopen_utf8.o
443OBJS += deps/libretro-common/encodings/encoding_utf.o
444OBJS += deps/libretro-common/streams/file_stream.o
445OBJS += deps/libretro-common/streams/file_stream_transforms.o
446OBJS += deps/libretro-common/time/rtime.o
447CFLAGS += -DUSE_LIBRETRO_VFS
448endif
449OBJS += frontend/libretro.o
450CFLAGS += -DHAVE_LIBRETRO
451INC_LIBRETRO_COMMON := 1
452
453endif # $(PLATFORM) == "libretro"
454
455ifeq "$(USE_RTHREADS)" "1"
456OBJS += frontend/libretro-rthreads.o
457OBJS += deps/libretro-common/features/features_cpu.o
458frontend/main.o: CFLAGS += -DHAVE_RTHREADS
459INC_LIBRETRO_COMMON := 1
460endif
461ifeq "$(INC_LIBRETRO_COMMON)" "1"
462CFLAGS += -Ideps/libretro-common/include
463endif
464
465ifeq "$(USE_PLUGIN_LIB)" "1"
466OBJS += frontend/plugin_lib.o
467OBJS += frontend/libpicofe/linux/plat.o
468OBJS += frontend/libpicofe/readpng.o frontend/libpicofe/fonts.o
469frontend/libpicofe/linux/plat.o: CFLAGS += -DNO_HOME_DIR
470ifeq "$(HAVE_NEON_ASM)" "1"
471OBJS += frontend/libpicofe/arm/neon_scale2x.o
472OBJS += frontend/libpicofe/arm/neon_eagle2x.o
473frontend/libpicofe/arm/neon_scale2x.o: CFLAGS += -DDO_BGR_TO_RGB
474frontend/libpicofe/arm/neon_eagle2x.o: CFLAGS += -DDO_BGR_TO_RGB
475endif
476endif
477ifeq "$(USE_FRONTEND)" "1"
478OBJS += frontend/menu.o
479OBJS += frontend/libpicofe/input.o
480frontend/libpicofe/input.o: CFLAGS += -Wno-array-bounds
481frontend/menu.o: frontend/libpicofe/menu.c
482ifeq "$(HAVE_TSLIB)" "1"
483frontend/%.o: CFLAGS += -DHAVE_TSLIB
484OBJS += frontend/pl_gun_ts.o
485endif
486else
487CFLAGS += -DNO_FRONTEND
488endif
489
490# misc
491OBJS += frontend/main.o frontend/plugin.o
492frontend/main.o libpcsxcore/misc.o: CFLAGS += -DBUILTIN_GPU=$(BUILTIN_GPU)
493
494frontend/menu.o frontend/main.o: include/revision.h
495frontend/plat_sdl.o frontend/libretro.o: include/revision.h
496libpcsxcore/misc.o: include/revision.h
497
498CFLAGS += $(CFLAGS_LAST)
499
500frontend/libpicofe/%.c:
501 @echo "libpicofe module is missing, please run:"
502 @echo "git submodule init && git submodule update"
503 @exit 1
504
505libpcsxcore/gte_nf.o: libpcsxcore/gte.c
506 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
507
508include/revision.h: FORCE
509 @(git describe --always || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
510 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
511 @rm $@_
512
513%.o: %.S
514 $(CC_AS) $(CFLAGS) -c $^ -o $@
515
516
517target_: $(TARGET)
518
519$(TARGET): $(OBJS)
520ifeq ($(PARTIAL_LINKING), 1)
521 $(LD) -o $(basename $(TARGET))1.o -r --gc-sections $(addprefix -u ,$(shell cat frontend/libretro-extern)) $(addprefix -u ,$(EXTRA_EXTERN_SYMS)) $^
522 $(OBJCOPY) --keep-global-symbols=frontend/libretro-extern $(addprefix -G ,$(EXTRA_EXTERN_SYMS)) $(basename $(TARGET))1.o $(basename $(TARGET)).o
523 $(AR) rcs $@ $(basename $(TARGET)).o
524else ifeq ($(STATIC_LINKING), 1)
525 $(AR) rcs $@ $^
526else
527 $(CC_LINK) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LDLIBS) $(EXTRA_LDFLAGS)
528endif
529
530clean: $(PLAT_CLEAN) clean_plugins
531 $(RM) $(TARGET) *.o $(OBJS) $(TARGET).map include/revision.h
532
533ifneq ($(PLUGINS),)
534plugins_: $(PLUGINS)
535
536plugins/gpulib/gpulib.$(ARCH).a:
537 $(MAKE) -C plugins/gpulib/
538
539$(PLUGINS): plugins/gpulib/gpulib.$(ARCH).a
540 $(MAKE) -C $(dir $@)
541
542clean_plugins:
543 $(MAKE) -C plugins/gpulib/ clean
544 for dir in $(PLUGINS) ; do \
545 $(MAKE) -C $$(dirname $$dir) clean; done
546else
547plugins_:
548clean_plugins:
549endif
550
551.PHONY: all clean target_ plugins_ clean_plugins FORCE
552
553ifneq "$(PLATFORM)" "pandora"
554ifdef CPATH
555$(warning warning: CPATH is defined)
556endif
557endif
558
559# ----------- release -----------
560
561VER ?= $(shell git describe --always HEAD)
562
563ifeq "$(PLATFORM)" "generic"
564OUT = pcsx_rearmed_$(VER)
565
566rel: pcsx $(PLUGINS) \
567 frontend/pandora/skin readme.txt COPYING
568 rm -rf $(OUT)
569 mkdir -p $(OUT)/plugins
570 mkdir -p $(OUT)/bios
571 cp -r $^ $(OUT)/
572 -mv $(OUT)/*.so* $(OUT)/plugins/
573 zip -9 -r $(OUT).zip $(OUT)
574endif
575
576ifeq "$(PLATFORM)" "pandora"
577PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
578
579rel: pcsx plugins/dfsound/pcsxr_spu_area3.out $(PLUGINS) \
580 frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
581 frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
582 rm -rf out
583 mkdir -p out/plugins
584 cp -r $^ out/
585 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
586 rm out/pcsx.pxml.templ
587 -mv out/*.so out/plugins/
588 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c
589endif
590
591ifeq "$(PLATFORM)" "miyoo"
592
593rel: pcsx $(PLUGINS) \
594 frontend/320240/pcsx26.png \
595 frontend/320240/skin \
596 readme.txt COPYING
597 rm -rf out
598 mkdir -p out/pcsx_rearmed/plugins
599 cp -r $^ out/pcsx_rearmed/
600 -mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
601 mkdir out/pcsx_rearmed/lib/
602 mkdir out/pcsx_rearmed/bios/
603 cd out && zip -9 -r ../pcsx_rearmed_$(VER)_miyoo.zip *
604
605ipk: rel
606 VERSION="$(VER)" gm2xpkg -q -f miyoo/pkg.cfg
607 mv pcsx.ipk pcsx_rearmed.ipk
608endif
609
610ifeq "$(PLATFORM)" "caanoo"
611PLAT_CLEAN = caanoo_clean
612
613caanoo_clean:
614 $(RM) frontend/320240/pollux_set
615
616rel: pcsx $(PLUGINS) \
617 frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
618 frontend/320240/pcsxb.png frontend/320240/skin \
619 frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \
620 frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \
621 frontend/320240/haptic_s.cfg \
622 readme.txt COPYING
623 rm -rf out
624 mkdir -p out/pcsx_rearmed/plugins
625 cp -r $^ out/pcsx_rearmed/
626 -mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
627 mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe
628 mv out/pcsx_rearmed/pcsx_rearmed.ini out/
629 mkdir out/pcsx_rearmed/lib/
630 cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/
631 mkdir out/pcsx_rearmed/bios/
632 cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip *
633endif