Merge pull request #215 from libretro/kivutar/embedzlib
[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 ROOT_DIR     := $(LOCAL_PATH)/..
8 CORE_DIR     := $(ROOT_DIR)/libpcsxcore
9 SPU_DIR      := $(ROOT_DIR)/plugins/dfsound
10 GPU_DIR      := $(ROOT_DIR)/plugins/gpulib
11 CDR_DIR      := $(ROOT_DIR)/plugins/cdrcimg
12 INPUT_DIR    := $(ROOT_DIR)/plugins/dfinput
13 FRONTEND_DIR := $(ROOT_DIR)/frontend
14 NEON_DIR     := $(ROOT_DIR)/plugins/gpu_neon
15 UNAI_DIR     := $(ROOT_DIR)/plugins/gpu_unai
16 DYNAREC_DIR  := $(ROOT_DIR)/libpcsxcore/new_dynarec
17
18 # core
19 SOURCES_C := $(CORE_DIR)/cdriso.c \
20              $(CORE_DIR)/cdrom.c \
21              $(CORE_DIR)/cheat.c \
22              $(CORE_DIR)/debug.c \
23              $(CORE_DIR)/decode_xa.c \
24              $(CORE_DIR)/disr3000a.c \
25              $(CORE_DIR)/mdec.c \
26              $(CORE_DIR)/misc.c \
27              $(CORE_DIR)/plugins.c \
28              $(CORE_DIR)/ppf.c \
29              $(CORE_DIR)/psxbios.c \
30              $(CORE_DIR)/psxcommon.c \
31              $(CORE_DIR)/psxcounters.c \
32              $(CORE_DIR)/psxdma.c \
33              $(CORE_DIR)/psxhle.c \
34              $(CORE_DIR)/psxhw.c \
35              $(CORE_DIR)/psxinterpreter.c \
36              $(CORE_DIR)/psxmem.c \
37              $(CORE_DIR)/r3000a.c \
38              $(CORE_DIR)/sio.c \
39              $(CORE_DIR)/socket.c \
40              $(CORE_DIR)/spu.c \
41              $(CORE_DIR)/gte.c \
42              $(CORE_DIR)/gte_nf.c \
43              $(CORE_DIR)/gte_divider.c
44
45 # spu
46 SOURCES_C += $(SPU_DIR)/dma.c \
47              $(SPU_DIR)/freeze.c \
48              $(SPU_DIR)/registers.c \
49              $(SPU_DIR)/spu.c \
50              $(SPU_DIR)/out.c \
51              $(SPU_DIR)/nullsnd.c
52
53 # gpu
54 SOURCES_C += $(GPU_DIR)/gpu.c \
55              $(GPU_DIR)/vout_pl.c
56
57 # cdrcimg
58 SOURCES_C += $(CDR_DIR)/cdrcimg.c
59
60 # dfinput
61 SOURCES_C += $(INPUT_DIR)/main.c \
62              $(INPUT_DIR)/pad.c \
63              $(INPUT_DIR)/guncon.c
64
65 # frontend
66 SOURCES_C += $(FRONTEND_DIR)/main.c \
67              $(FRONTEND_DIR)/plugin.c \
68              $(FRONTEND_DIR)/cspace.c \
69              $(FRONTEND_DIR)/libretro.c
70
71 # dynarec
72 SOURCES_C += $(DYNAREC_DIR)/backends/psx/emu_if.c
73
74 COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED
75
76 ifeq ($(TARGET_ARCH),arm)
77   SOURCES_ASM := $(CORE_DIR)/gte_arm.S \
78                  $(SPU_DIR)/arm_utils.S \
79                  $(DYNAREC_DIR)/arm/linkage_arm.S
80   SOURCES_C   += $(DYNAREC_DIR)/new_dynarec.c \
81                  $(DYNAREC_DIR)/backends/psx/pcsxmem.c
82 else
83   COREFLAGS   += -DDRC_DISABLE
84   SOURCES_ASM :=
85 endif
86
87 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
88   COREFLAGS   += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
89   SOURCES_ASM += $(CORE_DIR)/gte_neon.S \
90                  $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \
91                  $(FRONTEND_DIR)/cspace_neon.S
92   SOURCES_C   += $(NEON_DIR)/psx_gpu_if.c
93 else ifeq ($(TARGET_ARCH_ABI),armeabi)
94   SOURCES_ASM += $(UNAI_DIR)/gpu_arm.s \
95                  $(FRONTEND_DIR)/cspace_arm.S
96   SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
97 else
98   SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp
99 endif
100
101 GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
102 ifneq ($(GIT_VERSION)," unknown")
103   COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
104 endif
105
106 include $(CLEAR_VARS)
107 LOCAL_MODULE        := retro
108 LOCAL_SRC_FILES     := $(SOURCES_C) $(SOURCES_ASM)
109 LOCAL_CFLAGS        := $(COREFLAGS)
110 LOCAL_C_INCLUDES    := $(ROOT_DIR)/include
111 LOCAL_LDFLAGS       := -Wl,-version-script=$(FRONTEND_DIR)/link.T
112 LOCAL_LDLIBS        := -lz -llog
113 LOCAL_ARM_MODE      := arm
114
115 ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
116   LOCAL_ARM_NEON  := true
117 endif
118 ifeq ($(TARGET_ARCH),arm)
119   LOCAL_LDLIBS    += -Wl,-no-warn-shared-textrel
120 endif
121
122 include $(BUILD_SHARED_LIBRARY)