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