Add missing files
[pcsx_rearmed.git] / jni / Android.mk
1 LOCAL_PATH := $(call my-dir)
2
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_))
6
7 HAVE_CHD ?= 1
8
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
19 DEPS_DIR     := $(ROOT_DIR)/deps
20 LIBRETRO_COMMON := $(ROOT_DIR)/libretro-common
21 EXTRA_INCLUDES :=
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
49
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
57
58 # gpu
59 SOURCES_C += $(GPU_DIR)/gpu.c \
60              $(GPU_DIR)/vout_pl.c
61
62 # cdrcimg
63 SOURCES_C += $(CDR_DIR)/cdrcimg.c
64
65 # dfinput
66 SOURCES_C += $(INPUT_DIR)/main.c \
67              $(INPUT_DIR)/pad.c \
68              $(INPUT_DIR)/guncon.c
69
70 # frontend
71 SOURCES_C += $(FRONTEND_DIR)/main.c \
72              $(FRONTEND_DIR)/plugin.c \
73              $(FRONTEND_DIR)/cspace.c \
74              $(FRONTEND_DIR)/libretro.c
75
76 # libchdr
77 SOURCES_C += \
78              $(DEPS_DIR)/crypto/md5.c \
79              $(DEPS_DIR)/crypto/sha1.c \
80              $(DEPS_DIR)/lzma-16.04/C/Alloc.c \
81              $(DEPS_DIR)/lzma-16.04/C/Bra86.c \
82              $(DEPS_DIR)/lzma-16.04/C/Bra.c \
83              $(DEPS_DIR)/lzma-16.04/C/BraIA64.c \
84              $(DEPS_DIR)/lzma-16.04/C/CpuArch.c \
85              $(DEPS_DIR)/lzma-16.04/C/Delta.c \
86              $(DEPS_DIR)/lzma-16.04/C/LzFind.c \
87              $(DEPS_DIR)/lzma-16.04/C/Lzma86Dec.c \
88              $(DEPS_DIR)/lzma-16.04/C/Lzma86Enc.c \
89              $(DEPS_DIR)/lzma-16.04/C/LzmaDec.c \
90              $(DEPS_DIR)/lzma-16.04/C/LzmaEnc.c \
91              $(DEPS_DIR)/lzma-16.04/C/LzmaLib.c \
92              $(DEPS_DIR)/lzma-16.04/C/Sort.c \
93              $(DEPS_DIR)/libchdr/src/libchdr_bitstream.c \
94              $(DEPS_DIR)/libchdr/src/libchdr_cdrom.c \
95              $(DEPS_DIR)/libchdr/src/libchdr_chd.c \
96              $(DEPS_DIR)/libchdr/src/libchdr_flac.c \
97              $(DEPS_DIR)/libchdr/src/libchdr_huffman.c
98 SOURCES_ASM :=
99
100 COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED
101 COREFLAGS += -DHAVE_CHD -D_7ZIP_ST
102
103 HAVE_ARI64=0
104 HAVE_LIGHTREC=0
105 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
106   HAVE_ARI64=1
107 else ifeq ($(TARGET_ARCH_ABI),armeabi)
108   HAVE_ARI64=1
109 else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
110   HAVE_LIGHTREC=1
111 else ifeq ($(TARGET_ARCH_ABI),x86_64)
112   HAVE_LIGHTREC=1
113 else ifeq ($(TARGET_ARCH_ABI),x86)
114   HAVE_LIGHTREC=1
115 else
116   COREFLAGS   += -DDRC_DISABLE
117 endif
118
119 ifeq ($(HAVE_ARI64),1)
120   COREFLAGS   += -DNEW_DYNAREC
121   SOURCES_ASM += $(CORE_DIR)/gte_arm.S \
122                  $(SPU_DIR)/arm_utils.S \
123                  $(DYNAREC_DIR)/arm/linkage_arm.S
124   SOURCES_C   += $(DYNAREC_DIR)/new_dynarec.c \
125                  $(DYNAREC_DIR)/backends/psx/pcsxmem.c
126 endif
127
128 ifeq ($(HAVE_LIGHTREC),1)
129   COREFLAGS   += -DLIGHTREC -DLIGHTREC_STATIC
130   EXTRA_INCLUDES += $(DEPS_DIR)/lightning/include \
131                                                   $(DEPS_DIR)/lightrec
132   SOURCES_C   += $(DEPS_DIR)/lightrec/blockcache.c \
133                                           $(DEPS_DIR)/lightrec/disassembler.c \
134                                           $(DEPS_DIR)/lightrec/emitter.c \
135                                           $(DEPS_DIR)/lightrec/interpreter.c \
136                                           $(DEPS_DIR)/lightrec/lightrec.c \
137                                           $(DEPS_DIR)/lightrec/memmanager.c \
138                                           $(DEPS_DIR)/lightrec/optimizer.c \
139                                           $(DEPS_DIR)/lightrec/regcache.c \
140                                           $(DEPS_DIR)/lightrec/recompiler.c \
141                                           $(DEPS_DIR)/lightrec/reaper.c
142   SOURCES_C   += $(DEPS_DIR)/lightning/lib/jit_disasm.c \
143                                           $(DEPS_DIR)/lightning/lib/jit_memory.c \
144                                           $(DEPS_DIR)/lightning/lib/jit_names.c \
145                                           $(DEPS_DIR)/lightning/lib/jit_note.c \
146                                           $(DEPS_DIR)/lightning/lib/jit_print.c \
147                                           $(DEPS_DIR)/lightning/lib/jit_size.c \
148                                           $(DEPS_DIR)/lightning/lib/lightning.c
149   SOURCES_C   += $(CORE_DIR)/lightrec/plugin.c
150 endif
151
152
153 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
154   COREFLAGS   += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP -DGPU_NEON
155   SOURCES_ASM += $(CORE_DIR)/gte_neon.S \
156                  $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \
157                  $(FRONTEND_DIR)/cspace_neon.S
158   SOURCES_C   += $(NEON_DIR)/psx_gpu_if.c
159   SOURCES_C   += $(DYNAREC_DIR)/backends/psx/emu_if.c
160 else ifeq ($(TARGET_ARCH_ABI),armeabi)
161   COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI
162   SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \
163                  $(FRONTEND_DIR)/cspace_arm.S
164   SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
165 else
166   COREFLAGS += -DUSE_GPULIB=1 -DGPU_UNAI
167   SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
168 endif
169
170 GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
171 ifneq ($(GIT_VERSION)," unknown")
172   COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
173 endif
174
175 include $(CLEAR_VARS)
176 LOCAL_MODULE        := retro
177 LOCAL_SRC_FILES     := $(SOURCES_C) $(SOURCES_ASM)
178 LOCAL_CFLAGS        := $(COREFLAGS)
179 LOCAL_C_INCLUDES    := $(ROOT_DIR)/include
180 LOCAL_C_INCLUDES    += $(DEPS_DIR)/crypto $(DEPS_DIR)/lzma-16.04/C $(DEPS_DIR)/libchdr/include $(DEPS_DIR)/libchdr/include/libchdr
181 LOCAL_C_INCLUDES    += $(LIBRETRO_COMMON)/include
182 LOCAL_C_INCLUDES    += $(EXTRA_INCLUDES)
183 LOCAL_LDFLAGS       := -Wl,-version-script=$(FRONTEND_DIR)/link.T
184 LOCAL_LDLIBS        := -lz -llog
185 LOCAL_ARM_MODE      := arm
186
187 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
188   LOCAL_ARM_NEON  := true
189 endif
190
191 include $(BUILD_SHARED_LIBRARY)