Commit | Line | Data |
---|---|---|
b2058a5b TK |
1 | LOCAL_PATH := $(call my-dir) |
2 | ||
08700dbe | 3 | $(shell cd "$(LOCAL_PATH)" && ((git describe --always || echo) | sed -e 's/.*/#define REV "\0"/' > ../frontend/revision.h_)) |
77668f25 AK |
4 | $(shell cd "$(LOCAL_PATH)" && (diff -q ../frontend/revision.h_ ../frontend/revision.h > /dev/null 2>&1 || cp ../frontend/revision.h_ ../frontend/revision.h)) |
5 | $(shell cd "$(LOCAL_PATH)" && (rm ../frontend/revision.h_)) | |
b2058a5b | 6 | |
cadb8854 | 7 | HAVE_CHD ?= 1 |
226a5691 | 8 | USE_LIBRETRO_VFS ?= 0 |
cadb8854 | 9 | |
77668f25 AK |
10 | ROOT_DIR := $(LOCAL_PATH)/.. |
11 | CORE_DIR := $(ROOT_DIR)/libpcsxcore | |
12 | SPU_DIR := $(ROOT_DIR)/plugins/dfsound | |
13 | GPU_DIR := $(ROOT_DIR)/plugins/gpulib | |
14 | CDR_DIR := $(ROOT_DIR)/plugins/cdrcimg | |
15 | INPUT_DIR := $(ROOT_DIR)/plugins/dfinput | |
16 | FRONTEND_DIR := $(ROOT_DIR)/frontend | |
17 | NEON_DIR := $(ROOT_DIR)/plugins/gpu_neon | |
18 | UNAI_DIR := $(ROOT_DIR)/plugins/gpu_unai | |
19 | DYNAREC_DIR := $(ROOT_DIR)/libpcsxcore/new_dynarec | |
275ed8df | 20 | DEPS_DIR := $(ROOT_DIR)/deps |
07597ed3 | 21 | LIBRETRO_COMMON := $(ROOT_DIR)/libretro-common |
87cc59de | 22 | EXTRA_INCLUDES := |
77668f25 AK |
23 | |
24 | # core | |
25 | SOURCES_C := $(CORE_DIR)/cdriso.c \ | |
26 | $(CORE_DIR)/cdrom.c \ | |
27 | $(CORE_DIR)/cheat.c \ | |
630b122b | 28 | $(CORE_DIR)/database.c \ |
77668f25 | 29 | $(CORE_DIR)/decode_xa.c \ |
77668f25 AK |
30 | $(CORE_DIR)/mdec.c \ |
31 | $(CORE_DIR)/misc.c \ | |
32 | $(CORE_DIR)/plugins.c \ | |
33 | $(CORE_DIR)/ppf.c \ | |
34 | $(CORE_DIR)/psxbios.c \ | |
35 | $(CORE_DIR)/psxcommon.c \ | |
36 | $(CORE_DIR)/psxcounters.c \ | |
37 | $(CORE_DIR)/psxdma.c \ | |
38 | $(CORE_DIR)/psxhle.c \ | |
39 | $(CORE_DIR)/psxhw.c \ | |
40 | $(CORE_DIR)/psxinterpreter.c \ | |
41 | $(CORE_DIR)/psxmem.c \ | |
42 | $(CORE_DIR)/r3000a.c \ | |
43 | $(CORE_DIR)/sio.c \ | |
77668f25 AK |
44 | $(CORE_DIR)/spu.c \ |
45 | $(CORE_DIR)/gte.c \ | |
46 | $(CORE_DIR)/gte_nf.c \ | |
47 | $(CORE_DIR)/gte_divider.c | |
b2058a5b | 48 | |
77668f25 AK |
49 | # spu |
50 | SOURCES_C += $(SPU_DIR)/dma.c \ | |
51 | $(SPU_DIR)/freeze.c \ | |
52 | $(SPU_DIR)/registers.c \ | |
53 | $(SPU_DIR)/spu.c \ | |
54 | $(SPU_DIR)/out.c \ | |
55 | $(SPU_DIR)/nullsnd.c | |
b2058a5b | 56 | |
77668f25 AK |
57 | # gpu |
58 | SOURCES_C += $(GPU_DIR)/gpu.c \ | |
59 | $(GPU_DIR)/vout_pl.c | |
b2058a5b | 60 | |
77668f25 AK |
61 | # cdrcimg |
62 | SOURCES_C += $(CDR_DIR)/cdrcimg.c | |
b2058a5b | 63 | |
77668f25 AK |
64 | # dfinput |
65 | SOURCES_C += $(INPUT_DIR)/main.c \ | |
66 | $(INPUT_DIR)/pad.c \ | |
67 | $(INPUT_DIR)/guncon.c | |
b2058a5b | 68 | |
77668f25 AK |
69 | # frontend |
70 | SOURCES_C += $(FRONTEND_DIR)/main.c \ | |
71 | $(FRONTEND_DIR)/plugin.c \ | |
72 | $(FRONTEND_DIR)/cspace.c \ | |
73 | $(FRONTEND_DIR)/libretro.c | |
b2058a5b | 74 | |
275ed8df | 75 | # libchdr |
76 | SOURCES_C += \ | |
c9e72d64 | 77 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Alloc.c \ |
78 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Bra86.c \ | |
79 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/BraIA64.c \ | |
80 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/CpuArch.c \ | |
81 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Delta.c \ | |
82 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzFind.c \ | |
83 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Lzma86Dec.c \ | |
84 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaDec.c \ | |
85 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/LzmaEnc.c \ | |
86 | $(DEPS_DIR)/libchdr/deps/lzma-19.00/src/Sort.c \ | |
2ff0b512 | 87 | $(DEPS_DIR)/libchdr/src/libchdr_bitstream.c \ |
88 | $(DEPS_DIR)/libchdr/src/libchdr_cdrom.c \ | |
89 | $(DEPS_DIR)/libchdr/src/libchdr_chd.c \ | |
90 | $(DEPS_DIR)/libchdr/src/libchdr_flac.c \ | |
91 | $(DEPS_DIR)/libchdr/src/libchdr_huffman.c | |
87cc59de | 92 | SOURCES_ASM := |
c82f907a | 93 | |
661e95f6 | 94 | COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED |
2ff0b512 | 95 | COREFLAGS += -DHAVE_CHD -D_7ZIP_ST |
b2058a5b | 96 | |
226a5691 | 97 | ifeq ($(USE_LIBRETRO_VFS),1) |
98 | SOURCES_C += \ | |
99 | $(LIBRETRO_COMMON)/compat/compat_posix_string.c \ | |
100 | $(LIBRETRO_COMMON)/compat/fopen_utf8.c \ | |
101 | $(LIBRETRO_COMMON)/encodings/compat_strl.c \ | |
102 | $(LIBRETRO_COMMON)/encodings/encoding_utf.c \ | |
103 | $(LIBRETRO_COMMON)/file/file_path.c \ | |
104 | $(LIBRETRO_COMMON)/streams/file_stream.c \ | |
105 | $(LIBRETRO_COMMON)/streams/file_stream_transforms.c \ | |
106 | $(LIBRETRO_COMMON)/string/stdstring.c \ | |
107 | $(LIBRETRO_COMMON)/time/rtime.c \ | |
108 | $(LIBRETRO_COMMON)/vfs/vfs_implementation.c | |
109 | COREFLAGS += -DUSE_LIBRETRO_VFS | |
110 | endif | |
111 | ||
87cc59de | 112 | HAVE_ARI64=0 |
113 | HAVE_LIGHTREC=0 | |
114 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | |
115 | HAVE_ARI64=1 | |
116 | else ifeq ($(TARGET_ARCH_ABI),armeabi) | |
117 | HAVE_ARI64=1 | |
118 | else ifeq ($(TARGET_ARCH_ABI),arm64-v8a) | |
630b122b | 119 | HAVE_ARI64=1 |
87cc59de | 120 | else ifeq ($(TARGET_ARCH_ABI),x86_64) |
121 | HAVE_LIGHTREC=1 | |
122 | else ifeq ($(TARGET_ARCH_ABI),x86) | |
123 | HAVE_LIGHTREC=1 | |
124 | else | |
125 | COREFLAGS += -DDRC_DISABLE | |
126 | endif | |
127 | ||
128 | ifeq ($(HAVE_ARI64),1) | |
77668f25 | 129 | SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \ |
630b122b | 130 | $(DYNAREC_DIR)/pcsxmem.c |
131 | ifeq ($(TARGET_ARCH_ABI),arm64-v8a) | |
132 | SOURCES_ASM += $(DYNAREC_DIR)/linkage_arm64.S | |
133 | else | |
134 | SOURCES_ASM += $(CORE_DIR)/gte_arm.S \ | |
135 | $(SPU_DIR)/arm_utils.S \ | |
136 | $(DYNAREC_DIR)/linkage_arm.S | |
137 | endif | |
b2058a5b | 138 | endif |
630b122b | 139 | SOURCES_C += $(DYNAREC_DIR)/emu_if.c |
b2058a5b | 140 | |
87cc59de | 141 | ifeq ($(HAVE_LIGHTREC),1) |
142 | COREFLAGS += -DLIGHTREC -DLIGHTREC_STATIC | |
143 | EXTRA_INCLUDES += $(DEPS_DIR)/lightning/include \ | |
e168d99d PC |
144 | $(DEPS_DIR)/lightrec \ |
145 | $(ROOT_DIR)/include/lightning \ | |
146 | $(ROOT_DIR)/include/lightrec | |
87cc59de | 147 | SOURCES_C += $(DEPS_DIR)/lightrec/blockcache.c \ |
148 | $(DEPS_DIR)/lightrec/disassembler.c \ | |
149 | $(DEPS_DIR)/lightrec/emitter.c \ | |
150 | $(DEPS_DIR)/lightrec/interpreter.c \ | |
151 | $(DEPS_DIR)/lightrec/lightrec.c \ | |
152 | $(DEPS_DIR)/lightrec/memmanager.c \ | |
153 | $(DEPS_DIR)/lightrec/optimizer.c \ | |
154 | $(DEPS_DIR)/lightrec/regcache.c \ | |
43d9bcdc | 155 | $(DEPS_DIR)/lightrec/recompiler.c \ |
156 | $(DEPS_DIR)/lightrec/reaper.c | |
87cc59de | 157 | SOURCES_C += $(DEPS_DIR)/lightning/lib/jit_disasm.c \ |
158 | $(DEPS_DIR)/lightning/lib/jit_memory.c \ | |
159 | $(DEPS_DIR)/lightning/lib/jit_names.c \ | |
160 | $(DEPS_DIR)/lightning/lib/jit_note.c \ | |
161 | $(DEPS_DIR)/lightning/lib/jit_print.c \ | |
162 | $(DEPS_DIR)/lightning/lib/jit_size.c \ | |
163 | $(DEPS_DIR)/lightning/lib/lightning.c | |
164 | SOURCES_C += $(CORE_DIR)/lightrec/plugin.c | |
165 | endif | |
166 | ||
167 | ||
77668f25 | 168 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) |
74ec4f3a | 169 | COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON |
77668f25 AK |
170 | SOURCES_ASM += $(CORE_DIR)/gte_neon.S \ |
171 | $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \ | |
172 | $(FRONTEND_DIR)/cspace_neon.S | |
173 | SOURCES_C += $(NEON_DIR)/psx_gpu_if.c | |
174 | else ifeq ($(TARGET_ARCH_ABI),armeabi) | |
030d1121 | 175 | COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI |
b26afb99 | 176 | SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \ |
77668f25 AK |
177 | $(FRONTEND_DIR)/cspace_arm.S |
178 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp | |
179 | else | |
030d1121 | 180 | COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI |
77668f25 | 181 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp |
b2058a5b TK |
182 | endif |
183 | ||
77668f25 AK |
184 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" |
185 | ifneq ($(GIT_VERSION)," unknown") | |
186 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" | |
b2058a5b TK |
187 | endif |
188 | ||
77668f25 AK |
189 | include $(CLEAR_VARS) |
190 | LOCAL_MODULE := retro | |
191 | LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_ASM) | |
192 | LOCAL_CFLAGS := $(COREFLAGS) | |
193 | LOCAL_C_INCLUDES := $(ROOT_DIR)/include | |
c9e72d64 | 194 | LOCAL_C_INCLUDES += $(DEPS_DIR)/crypto $(DEPS_DIR)/libchdr/deps/lzma-19.00/include $(DEPS_DIR)/libchdr/include $(DEPS_DIR)/libchdr/include/libchdr |
07597ed3 | 195 | LOCAL_C_INCLUDES += $(LIBRETRO_COMMON)/include |
87cc59de | 196 | LOCAL_C_INCLUDES += $(EXTRA_INCLUDES) |
77668f25 AK |
197 | LOCAL_LDFLAGS := -Wl,-version-script=$(FRONTEND_DIR)/link.T |
198 | LOCAL_LDLIBS := -lz -llog | |
199 | LOCAL_ARM_MODE := arm | |
200 | ||
201 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | |
202 | LOCAL_ARM_NEON := true | |
203 | endif | |
b2058a5b TK |
204 | |
205 | include $(BUILD_SHARED_LIBRARY) |