| 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 | |
| 21 | # core |
| 22 | SOURCES_C := $(CORE_DIR)/cdriso.c \ |
| 23 | $(CORE_DIR)/cdrom.c \ |
| 24 | $(CORE_DIR)/cheat.c \ |
| 25 | $(CORE_DIR)/debug.c \ |
| 26 | $(CORE_DIR)/decode_xa.c \ |
| 27 | $(CORE_DIR)/disr3000a.c \ |
| 28 | $(CORE_DIR)/mdec.c \ |
| 29 | $(CORE_DIR)/misc.c \ |
| 30 | $(CORE_DIR)/plugins.c \ |
| 31 | $(CORE_DIR)/ppf.c \ |
| 32 | $(CORE_DIR)/psxbios.c \ |
| 33 | $(CORE_DIR)/psxcommon.c \ |
| 34 | $(CORE_DIR)/psxcounters.c \ |
| 35 | $(CORE_DIR)/psxdma.c \ |
| 36 | $(CORE_DIR)/psxhle.c \ |
| 37 | $(CORE_DIR)/psxhw.c \ |
| 38 | $(CORE_DIR)/psxinterpreter.c \ |
| 39 | $(CORE_DIR)/psxmem.c \ |
| 40 | $(CORE_DIR)/r3000a.c \ |
| 41 | $(CORE_DIR)/sio.c \ |
| 42 | $(CORE_DIR)/socket.c \ |
| 43 | $(CORE_DIR)/spu.c \ |
| 44 | $(CORE_DIR)/gte.c \ |
| 45 | $(CORE_DIR)/gte_nf.c \ |
| 46 | $(CORE_DIR)/gte_divider.c |
| 47 | |
| 48 | # spu |
| 49 | SOURCES_C += $(SPU_DIR)/dma.c \ |
| 50 | $(SPU_DIR)/freeze.c \ |
| 51 | $(SPU_DIR)/registers.c \ |
| 52 | $(SPU_DIR)/spu.c \ |
| 53 | $(SPU_DIR)/out.c \ |
| 54 | $(SPU_DIR)/nullsnd.c |
| 55 | |
| 56 | # gpu |
| 57 | SOURCES_C += $(GPU_DIR)/gpu.c \ |
| 58 | $(GPU_DIR)/vout_pl.c |
| 59 | |
| 60 | # cdrcimg |
| 61 | SOURCES_C += $(CDR_DIR)/cdrcimg.c |
| 62 | |
| 63 | # dfinput |
| 64 | SOURCES_C += $(INPUT_DIR)/main.c \ |
| 65 | $(INPUT_DIR)/pad.c \ |
| 66 | $(INPUT_DIR)/guncon.c |
| 67 | |
| 68 | # frontend |
| 69 | SOURCES_C += $(FRONTEND_DIR)/main.c \ |
| 70 | $(FRONTEND_DIR)/plugin.c \ |
| 71 | $(FRONTEND_DIR)/cspace.c \ |
| 72 | $(FRONTEND_DIR)/libretro.c |
| 73 | |
| 74 | # libchdr |
| 75 | SOURCES_C += \ |
| 76 | $(DEPS_DIR)/crypto/md5.c \ |
| 77 | $(DEPS_DIR)/crypto/sha1.c \ |
| 78 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/bitmath.c \ |
| 79 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/bitreader.c \ |
| 80 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/cpu.c \ |
| 81 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/crc.c \ |
| 82 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed.c \ |
| 83 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed_intrin_sse2.c \ |
| 84 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/fixed_intrin_ssse3.c \ |
| 85 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/float.c \ |
| 86 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/format.c \ |
| 87 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc.c \ |
| 88 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_avx2.c \ |
| 89 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse2.c \ |
| 90 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse41.c \ |
| 91 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/lpc_intrin_sse.c \ |
| 92 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/md5.c \ |
| 93 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/memory.c \ |
| 94 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/metadata_iterators.c \ |
| 95 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/metadata_object.c \ |
| 96 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/stream_decoder.c \ |
| 97 | $(DEPS_DIR)/flac-1.3.2/src/libFLAC/window.c \ |
| 98 | $(DEPS_DIR)/lzma-16.04/C/Alloc.c \ |
| 99 | $(DEPS_DIR)/lzma-16.04/C/Bra86.c \ |
| 100 | $(DEPS_DIR)/lzma-16.04/C/Bra.c \ |
| 101 | $(DEPS_DIR)/lzma-16.04/C/BraIA64.c \ |
| 102 | $(DEPS_DIR)/lzma-16.04/C/CpuArch.c \ |
| 103 | $(DEPS_DIR)/lzma-16.04/C/Delta.c \ |
| 104 | $(DEPS_DIR)/lzma-16.04/C/LzFind.c \ |
| 105 | $(DEPS_DIR)/lzma-16.04/C/Lzma86Dec.c \ |
| 106 | $(DEPS_DIR)/lzma-16.04/C/Lzma86Enc.c \ |
| 107 | $(DEPS_DIR)/lzma-16.04/C/LzmaDec.c \ |
| 108 | $(DEPS_DIR)/lzma-16.04/C/LzmaEnc.c \ |
| 109 | $(DEPS_DIR)/lzma-16.04/C/LzmaLib.c \ |
| 110 | $(DEPS_DIR)/lzma-16.04/C/Sort.c \ |
| 111 | $(DEPS_DIR)/libchdr/bitstream.c \ |
| 112 | $(DEPS_DIR)/libchdr/cdrom.c \ |
| 113 | $(DEPS_DIR)/libchdr/chd.c \ |
| 114 | $(DEPS_DIR)/libchdr/flac.c \ |
| 115 | $(DEPS_DIR)/libchdr/huffman.c |
| 116 | |
| 117 | # dynarec |
| 118 | SOURCES_C += $(DYNAREC_DIR)/backends/psx/emu_if.c |
| 119 | |
| 120 | COREFLAGS := -ffast-math -funroll-loops -DHAVE_LIBRETRO -DNO_FRONTEND -DFRONTEND_SUPPORTS_RGB565 -DANDROID -DREARMED |
| 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 |
| 122 | COREFLAGS += -DHAVE_CHD |
| 123 | |
| 124 | ifeq ($(TARGET_ARCH),arm) |
| 125 | SOURCES_ASM := $(CORE_DIR)/gte_arm.S \ |
| 126 | $(SPU_DIR)/arm_utils.S \ |
| 127 | $(DYNAREC_DIR)/arm/linkage_arm.S |
| 128 | SOURCES_C += $(DYNAREC_DIR)/new_dynarec.c \ |
| 129 | $(DYNAREC_DIR)/backends/psx/pcsxmem.c |
| 130 | else |
| 131 | COREFLAGS += -DDRC_DISABLE |
| 132 | SOURCES_ASM := |
| 133 | endif |
| 134 | |
| 135 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) |
| 136 | COREFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP |
| 137 | SOURCES_ASM += $(CORE_DIR)/gte_neon.S \ |
| 138 | $(NEON_DIR)/psx_gpu/psx_gpu_arm_neon.S \ |
| 139 | $(FRONTEND_DIR)/cspace_neon.S |
| 140 | SOURCES_C += $(NEON_DIR)/psx_gpu_if.c |
| 141 | else ifeq ($(TARGET_ARCH_ABI),armeabi) |
| 142 | SOURCES_ASM += $(UNAI_DIR)/gpu_arm.S \ |
| 143 | $(FRONTEND_DIR)/cspace_arm.S |
| 144 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp |
| 145 | else |
| 146 | SOURCES_C += $(UNAI_DIR)/gpulib_if.cpp |
| 147 | endif |
| 148 | |
| 149 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" |
| 150 | ifneq ($(GIT_VERSION)," unknown") |
| 151 | COREFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" |
| 152 | endif |
| 153 | |
| 154 | include $(CLEAR_VARS) |
| 155 | LOCAL_MODULE := retro |
| 156 | LOCAL_SRC_FILES := $(SOURCES_C) $(SOURCES_ASM) |
| 157 | LOCAL_CFLAGS := $(COREFLAGS) |
| 158 | LOCAL_C_INCLUDES := $(ROOT_DIR)/include |
| 159 | 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 |
| 160 | LOCAL_LDFLAGS := -Wl,-version-script=$(FRONTEND_DIR)/link.T |
| 161 | LOCAL_LDLIBS := -lz -llog |
| 162 | LOCAL_ARM_MODE := arm |
| 163 | |
| 164 | ifeq ($(TARGET_ARCH_ABI),armeabi-v7a) |
| 165 | LOCAL_ARM_NEON := true |
| 166 | endif |
| 167 | ifeq ($(TARGET_ARCH),arm) |
| 168 | LOCAL_LDLIBS += -Wl,-no-warn-shared-textrel |
| 169 | endif |
| 170 | |
| 171 | include $(BUILD_SHARED_LIBRARY) |