Commit | Line | Data |
---|---|---|
b2058a5b TK |
1 | LOCAL_PATH := $(call my-dir) |
2 | ||
77668f25 AK |
3 | $(shell cd "$(LOCAL_PATH)" && ((git describe || echo) | sed -e 's/.*/#define REV "\0"/' > ../frontend/revision.h_)) |
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 T |
7 | HAVE_CHD ?= 1 |
8 | ||
77668f25 AK |
9 | ROOT_DIR := $(LOCAL_PATH)/.. |
10 | CORE_DIR := $(ROOT_DIR)/libpcsxcore | |
11 | SPU_DIR := $(ROOT_DIR)/plugins/dfsound | |
12 | GPU_DIR := $(ROOT_DIR)/plugins/gpulib | |
13 | CDR_DIR := $(ROOT_DIR)/plugins/cdrcimg | |
14 | INPUT_DIR := $(ROOT_DIR)/plugins/dfinput | |
15 | FRONTEND_DIR := $(ROOT_DIR)/frontend | |
16 | NEON_DIR := $(ROOT_DIR)/plugins/gpu_neon | |
17 | UNAI_DIR := $(ROOT_DIR)/plugins/gpu_unai | |
18 | DYNAREC_DIR := $(ROOT_DIR)/libpcsxcore/new_dynarec | |
275ed8df | 19 | DEPS_DIR := $(ROOT_DIR)/deps |
07597ed3 | 20 | LIBRETRO_COMMON := $(ROOT_DIR)/libretro-common |
87cc59de | 21 | EXTRA_INCLUDES := |
77668f25 AK |
22 | |
23 | # core | |
24 | SOURCES_C := $(CORE_DIR)/cdriso.c \ | |
25 | $(CORE_DIR)/cdrom.c \ | |
26 | $(CORE_DIR)/cheat.c \ | |
27 | $(CORE_DIR)/debug.c \ | |
28 | $(CORE_DIR)/decode_xa.c \ | |
29 | $(CORE_DIR)/disr3000a.c \ | |
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 \ | |
44 | $(CORE_DIR)/socket.c \ | |
45 | $(CORE_DIR)/spu.c \ | |
46 | $(CORE_DIR)/gte.c \ | |
47 | $(CORE_DIR)/gte_nf.c \ | |
48 | $(CORE_DIR)/gte_divider.c | |
b2058a5b | 49 | |
77668f25 AK |
50 | # spu |
51 | SOURCES_C += $(SPU_DIR)/dma.c \ | |
52 | $(SPU_DIR)/freeze.c \ | |
53 | $(SPU_DIR)/registers.c \ | |
54 | $(SPU_DIR)/spu.c \ | |
55 | $(SPU_DIR)/out.c \ | |
56 | $(SPU_DIR)/nullsnd.c | |
b2058a5b | 57 | |
77668f25 AK |
58 | # gpu |
59 | SOURCES_C += $(GPU_DIR)/gpu.c \ | |
60 | $(GPU_DIR)/vout_pl.c | |
b2058a5b | 61 | |
77668f25 AK |
62 | # cdrcimg |
63 | SOURCES_C += $(CDR_DIR)/cdrcimg.c | |
b2058a5b | 64 | |
77668f25 AK |
65 | # dfinput |
66 | SOURCES_C += $(INPUT_DIR)/main.c \ | |
67 | $(INPUT_DIR)/pad.c \ | |
68 | $(INPUT_DIR)/guncon.c | |
b2058a5b | 69 | |
77668f25 AK |
70 | # frontend |
71 | SOURCES_C += $(FRONTEND_DIR)/main.c \ | |
72 | $(FRONTEND_DIR)/plugin.c \ | |
73 | $(FRONTEND_DIR)/cspace.c \ | |
74 | $(FRONTEND_DIR)/libretro.c | |
b2058a5b | 75 | |
275ed8df | 76 | # libchdr |
77 | SOURCES_C += \ | |
78 | $(DEPS_DIR)/crypto/md5.c \ | |
79 | $(DEPS_DIR)/crypto/sha1.c \ | |
80 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/bitmath.c \ | |
81 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/bitreader.c \ | |
82 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/cpu.c \ | |
83 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/crc.c \ | |
84 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed.c \ | |
85 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed_intrin_sse2.c \ | |
86 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed_intrin_ssse3.c \ | |
87 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/float.c \ | |
88 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/format.c \ | |
89 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc.c \ | |
90 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_avx2.c \ | |
91 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse2.c \ | |
92 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse41.c \ | |
93 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse.c \ | |
94 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/md5.c \ | |
95 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/memory.c \ | |
96 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/metadata_iterators.c \ | |
97 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/metadata_object.c \ | |
98 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/stream_decoder.c \ | |
99 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/window.c \ | |
100 | $(DEPS_DIR)/lzma-16.04/C/Alloc.c \ | |
101 | $(DEPS_DIR)/lzma-16.04/C/Bra86.c \ | |
102 | $(DEPS_DIR)/lzma-16.04/C/Bra.c \ | |
103 | $(DEPS_DIR)/lzma-16.04/C/BraIA64.c \ | |
104 | $(DEPS_DIR)/lzma-16.04/C/CpuArch.c \ | |
105 | $(DEPS_DIR)/lzma-16.04/C/Delta.c \ | |
106 | $(DEPS_DIR)/lzma-16.04/C/LzFind.c \ | |
107 | $(DEPS_DIR)/lzma-16.04/C/Lzma86Dec.c \ | |
108 | $(DEPS_DIR)/lzma-16.04/C/Lzma86Enc.c \ | |
109 | $(DEPS_DIR)/lzma-16.04/C/LzmaDec.c \ | |
110 | $(DEPS_DIR)/lzma-16.04/C/LzmaEnc.c \ | |
111 | $(DEPS_DIR)/lzma-16.04/C/LzmaLib.c \ | |
112 | $(DEPS_DIR)/lzma-16.04/C/Sort.c \ | |
113 | $(DEPS_DIR)/libchdr/bitstream.c \ | |
114 | $(DEPS_DIR)/libchdr/cdrom.c \ | |
115 | $(DEPS_DIR)/libchdr/chd.c \ | |
116 | $(DEPS_DIR)/libchdr/flac.c \ | |
117 | $(DEPS_DIR)/libchdr/huffman.c | |
87cc59de | 118 | SOURCES_ASM := |
c82f907a | 119 | |
661e95f6 | 120 | COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED |
275ed8df | 121 | COREFLAGS += -DPACKAGE_VERSION=\"1.3.2\" -DFLAC__HAS_OGG=0 -DFLAC__NO_DLL -DHAVE_LROUND -DHAVE_STDINT_H -DHAVE_STDLIB_H -DFLAC__NO_DLL -D_7ZIP_ST -DHAVE_SYS_PARAM_H |
47747a78 | 122 | COREFLAGS += -DHAVE_CHD |
b2058a5b | 123 | |
87cc59de | 124 | HAVE_ARI64=0 |
125 | HAVE_LIGHTREC=0 | |
126 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | |
127 | HAVE_ARI64=1 | |
128 | else ifeq ($(TARGET_ARCH_ABI),armeabi) | |
129 | HAVE_ARI64=1 | |
130 | else ifeq ($(TARGET_ARCH_ABI),arm64-v8a) | |
131 | HAVE_LIGHTREC=1 | |
132 | else ifeq ($(TARGET_ARCH_ABI),x86_64) | |
133 | HAVE_LIGHTREC=1 | |
134 | else ifeq ($(TARGET_ARCH_ABI),x86) | |
135 | HAVE_LIGHTREC=1 | |
136 | else | |
137 | COREFLAGS += -DDRC_DISABLE | |
138 | endif | |
139 | ||
140 | ifeq ($(HAVE_ARI64),1) | |
141 | COREFLAGS += -DNEW_DYNAREC | |
142 | SOURCES_ASM += $(CORE_DIR)/gte_arm.S \ | |
77668f25 AK |
143 | $(SPU_DIR)/arm_utils.S \ |
144 | $(DYNAREC_DIR)/arm/linkage_arm.S | |
145 | SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \ | |
146 | $(DYNAREC_DIR)/backends/psx/pcsxmem.c | |
b2058a5b TK |
147 | endif |
148 | ||
87cc59de | 149 | ifeq ($(HAVE_LIGHTREC),1) |
150 | COREFLAGS += -DLIGHTREC -DLIGHTREC_STATIC | |
151 | EXTRA_INCLUDES += $(DEPS_DIR)/lightning/include \ | |
152 | $(DEPS_DIR)/lightrec | |
153 | SOURCES_C += $(DEPS_DIR)/lightrec/blockcache.c \ | |
154 | $(DEPS_DIR)/lightrec/disassembler.c \ | |
155 | $(DEPS_DIR)/lightrec/emitter.c \ | |
156 | $(DEPS_DIR)/lightrec/interpreter.c \ | |
157 | $(DEPS_DIR)/lightrec/lightrec.c \ | |
158 | $(DEPS_DIR)/lightrec/memmanager.c \ | |
159 | $(DEPS_DIR)/lightrec/optimizer.c \ | |
160 | $(DEPS_DIR)/lightrec/regcache.c \ | |
161 | $(DEPS_DIR)/lightrec/recompiler.c | |
162 | SOURCES_C += $(DEPS_DIR)/lightning/lib/jit_disasm.c \ | |
163 | $(DEPS_DIR)/lightning/lib/jit_memory.c \ | |
164 | $(DEPS_DIR)/lightning/lib/jit_names.c \ | |
165 | $(DEPS_DIR)/lightning/lib/jit_note.c \ | |
166 | $(DEPS_DIR)/lightning/lib/jit_print.c \ | |
167 | $(DEPS_DIR)/lightning/lib/jit_size.c \ | |
168 | $(DEPS_DIR)/lightning/lib/lightning.c | |
169 | SOURCES_C += $(CORE_DIR)/lightrec/plugin.c | |
170 | endif | |
171 | ||
172 | ||
77668f25 | 173 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) |
74ec4f3a | 174 | COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON |
77668f25 AK |
175 | SOURCES_ASM += $(CORE_DIR)/gte_neon.S \ |
176 | $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \ | |
177 | $(FRONTEND_DIR)/cspace_neon.S | |
178 | SOURCES_C += $(NEON_DIR)/psx_gpu_if.c | |
87cc59de | 179 | SOURCES_C += $(DYNAREC_DIR)/backends/psx/emu_if.c |
77668f25 | 180 | else ifeq ($(TARGET_ARCH_ABI),armeabi) |
030d1121 | 181 | COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI |
182 | COREFLAGS += -DINLINE="static __inline__" -Dasm="__asm__ __volatile__" | |
b26afb99 | 183 | SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \ |
77668f25 AK |
184 | $(FRONTEND_DIR)/cspace_arm.S |
185 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp | |
186 | else | |
030d1121 | 187 | COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI |
188 | COREFLAGS += -DINLINE="static __inline__" -Dasm="__asm__ __volatile__" | |
77668f25 | 189 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp |
b2058a5b TK |
190 | endif |
191 | ||
77668f25 AK |
192 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" |
193 | ifneq ($(GIT_VERSION)," unknown") | |
194 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" | |
b2058a5b TK |
195 | endif |
196 | ||
77668f25 AK |
197 | include $(CLEAR_VARS) |
198 | LOCAL_MODULE := retro | |
199 | LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_ASM) | |
200 | LOCAL_CFLAGS := $(COREFLAGS) | |
201 | LOCAL_C_INCLUDES := $(ROOT_DIR)/include | |
275ed8df | 202 | LOCAL_C_INCLUDES += $(DEPS_DIR)/crypto $(DEPS_DIR)/flac-1.3.2/include $(DEPS_DIR)/flac-1.3.2/src/libFLAC/include $(DEPS_DIR)/lzma-16.04/C $(DEPS_DIR)/libchdr |
07597ed3 | 203 | LOCAL_C_INCLUDES += $(LIBRETRO_COMMON)/include |
87cc59de | 204 | LOCAL_C_INCLUDES += $(EXTRA_INCLUDES) |
77668f25 AK |
205 | LOCAL_LDFLAGS := -Wl,-version-script=$(FRONTEND_DIR)/link.T |
206 | LOCAL_LDLIBS := -lz -llog | |
207 | LOCAL_ARM_MODE := arm | |
208 | ||
209 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) | |
210 | LOCAL_ARM_NEON := true | |
211 | endif | |
212 | ifeq ($(TARGET_ARCH),arm) | |
213 | LOCAL_LDLIBS += -Wl,-no-warn-shared-textrel | |
b2058a5b | 214 | endif |
b2058a5b TK |
215 | |
216 | include $(BUILD_SHARED_LIBRARY) |