| 1 | # Makefile for PCSX ReARMed (libretro) |
| 2 | |
| 3 | DEBUG ?= 0 |
| 4 | WANT_ZLIB ?= 1 |
| 5 | HAVE_CHD ?= 1 |
| 6 | USE_LIBRETRO_VFS ?= 0 |
| 7 | |
| 8 | # Dynarec options: lightrec, ari64 |
| 9 | DYNAREC ?= lightrec |
| 10 | |
| 11 | ifeq ($(platform),) |
| 12 | platform = unix |
| 13 | ifeq ($(shell uname -a),) |
| 14 | platform = win |
| 15 | else ifneq ($(findstring MINGW,$(shell uname -a)),) |
| 16 | platform = win |
| 17 | else ifneq ($(findstring Darwin,$(shell uname -a)),) |
| 18 | platform = osx |
| 19 | else ifneq ($(findstring win,$(shell uname -a)),) |
| 20 | platform = win |
| 21 | endif |
| 22 | endif |
| 23 | |
| 24 | CC ?= gcc |
| 25 | CXX ?= g++ |
| 26 | AS ?= as |
| 27 | CC_AS ?= $(CC) |
| 28 | CFLAGS ?= |
| 29 | |
| 30 | TARGET_NAME := pcsx_rearmed |
| 31 | ARCH_DETECTED := $(shell $(CC) -dumpmachine | awk -F- '{print $$1}') |
| 32 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" |
| 33 | ifneq ($(GIT_VERSION)," unknown") |
| 34 | CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" |
| 35 | endif |
| 36 | ifneq ($(WANT_ZLIB),1) |
| 37 | LIBZ := -lz |
| 38 | endif |
| 39 | LIBPTHREAD := -lpthread |
| 40 | ifneq ($(findstring Haiku,$(shell uname -s)),) |
| 41 | LIBDL := -lroot -lnetwork |
| 42 | else |
| 43 | LIBDL := -ldl |
| 44 | endif |
| 45 | LIBM := -lm |
| 46 | MMAP_WIN32 = 0 |
| 47 | EXTRA_LDFLAGS = |
| 48 | |
| 49 | # Unix |
| 50 | ifeq ($(platform), unix) |
| 51 | TARGET := $(TARGET_NAME)_libretro.so |
| 52 | fpic := -fPIC |
| 53 | THREAD_RENDERING = 1 |
| 54 | ifneq ($(findstring SunOS,$(shell uname -s)),) |
| 55 | CC = gcc |
| 56 | endif |
| 57 | ifneq (,$(findstring $(ARCH_DETECTED),arm aarch64)) |
| 58 | DYNAREC = ari64 |
| 59 | |
| 60 | ifneq ($(findstring __thumb__,$(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h)),) |
| 61 | # must disable thumb as ari64 can't handle it |
| 62 | CFLAGS += -marm |
| 63 | endif |
| 64 | endif |
| 65 | |
| 66 | # ODROIDN2 |
| 67 | else ifneq (,$(findstring CortexA73_G12B,$(platform))) |
| 68 | TARGET := $(TARGET_NAME)_libretro.so |
| 69 | fpic := -fPIC |
| 70 | SHARED := -shared -Wl,-version-script=link.T |
| 71 | ARCH = arm64 |
| 72 | DYNAREC ?= ari64 |
| 73 | CFLAGS += -fomit-frame-pointer -ffast-math -DARM |
| 74 | CPUFLAGS += -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a73 -mtune=cortex-a73.cortex-a53 |
| 75 | |
| 76 | # ALLWINNER H5 |
| 77 | else ifneq (,$(findstring h5,$(platform))) |
| 78 | TARGET := $(TARGET_NAME)_libretro.so |
| 79 | fpic := -fPIC |
| 80 | SHARED := -shared -Wl,-version-script=link.T |
| 81 | ARCH = arm64 |
| 82 | DYNAREC ?= ari64 |
| 83 | CFLAGS += -fomit-frame-pointer -ffast-math -DARM |
| 84 | CPUFLAGS += -march=armv8-a+crc -mfpu=neon-fp-armv8 -mcpu=cortex-a53 -mtune=cortex-a53 |
| 85 | |
| 86 | else ifeq ($(platform), linux-portable) |
| 87 | TARGET := $(TARGET_NAME)_libretro.so |
| 88 | fpic := -fPIC -nostdlib |
| 89 | EXTRA_LDFLAGS += -fPIC -nostdlib |
| 90 | LIBZ := |
| 91 | LIBPTHREAD := |
| 92 | LIBDL := |
| 93 | LIBM := |
| 94 | NO_UNDEF_CHECK = 1 |
| 95 | |
| 96 | # OS X |
| 97 | else ifeq ($(platform), osx) |
| 98 | DYNAREC := 0 |
| 99 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 100 | fpic := -fPIC |
| 101 | HAVE_NEON = 0 |
| 102 | MACSOSVER = `sw_vers -productVersion | cut -d. -f 1` |
| 103 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 104 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 105 | ifeq ($(OSX_LT_MAVERICKS),YES) |
| 106 | fpic += -mmacosx-version-min=10.1 |
| 107 | endif |
| 108 | |
| 109 | ifeq ($(CROSS_COMPILE),1) |
| 110 | TARGET_RULE = -target $(LIBRETRO_APPLE_PLATFORM) -isysroot $(LIBRETRO_APPLE_ISYSROOT) |
| 111 | CFLAGS += $(TARGET_RULE) |
| 112 | CPPFLAGS += $(TARGET_RULE) |
| 113 | CXXFLAGS += $(TARGET_RULE) |
| 114 | LDFLAGS += $(TARGET_RULE) |
| 115 | endif |
| 116 | |
| 117 | CFLAGS += $(ARCHFLAGS) |
| 118 | CXXFLAGS += $(ARCHFLAGS) |
| 119 | LDFLAGS += $(ARCHFLAGS) |
| 120 | |
| 121 | # iOS |
| 122 | else ifneq (,$(findstring ios,$(platform))) |
| 123 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 124 | MINVERSION := |
| 125 | ifeq ($(DYNAREC),lightrec) |
| 126 | # Override |
| 127 | DYNAREC := 0 |
| 128 | endif |
| 129 | fpic := -fPIC |
| 130 | |
| 131 | ifeq ($(IOSSDK),) |
| 132 | IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) |
| 133 | endif |
| 134 | |
| 135 | CFLAGS += -DIOS -marm |
| 136 | ifeq ($(platform),ios-arm64) |
| 137 | CC = cc -arch arm64 -isysroot $(IOSSDK) |
| 138 | CXX = c++ -arch arm64 -isysroot $(IOSSDK) |
| 139 | ARCH := arm64 |
| 140 | HAVE_NEON = 0 |
| 141 | BUILTIN_GPU = peops |
| 142 | DYNAREC = 0 |
| 143 | else |
| 144 | CC = cc -arch armv7 -isysroot $(IOSSDK) |
| 145 | CXX = c++ -arch armv7 -isysroot $(IOSSDK) |
| 146 | ARCH := arm |
| 147 | HAVE_NEON = 1 |
| 148 | BUILTIN_GPU = neon |
| 149 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 150 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 151 | endif |
| 152 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) |
| 153 | ifeq ($(platform),$(filter $(platform),ios9 ios-arm64)) |
| 154 | MINVERSION = -miphoneos-version-min=8.0 |
| 155 | else |
| 156 | MINVERSION = -miphoneos-version-min=5.0 |
| 157 | endif |
| 158 | CFLAGS += $(MINVERSION) |
| 159 | |
| 160 | else ifeq ($(platform), tvos-arm64) |
| 161 | TARGET := $(TARGET_NAME)_libretro_tvos.dylib |
| 162 | MINVERSION := |
| 163 | ifeq ($(DYNAREC),lightrec) |
| 164 | # Override |
| 165 | DYNAREC := 0 |
| 166 | endif |
| 167 | fpic := -fPIC |
| 168 | |
| 169 | ifeq ($(IOSSDK),) |
| 170 | IOSSDK := $(shell xcodebuild -version -sdk appletvos Path) |
| 171 | endif |
| 172 | |
| 173 | CFLAGS += -DIOS -DTVOS -marm |
| 174 | CC = cc -arch arm64 -isysroot $(IOSSDK) |
| 175 | CXX = c++ -arch arm64 -isysroot $(IOSSDK) |
| 176 | ARCH := arm64 |
| 177 | HAVE_NEON = 0 |
| 178 | BUILTIN_GPU = peops |
| 179 | DYNAREC = 0 |
| 180 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) |
| 181 | |
| 182 | # Nintendo Switch (libnx) |
| 183 | else ifeq ($(platform), libnx) |
| 184 | export DEPSDIR := $(CURDIR)/ |
| 185 | include $(DEVKITPRO)/libnx/switch_rules |
| 186 | TARGET := $(TARGET_NAME)_libretro_$(platform).a |
| 187 | ARCH := arm64 |
| 188 | BUILTIN_GPU = unai |
| 189 | HAVE_VFS_FD = 0 |
| 190 | CFLAGS += -O3 -fomit-frame-pointer -ffast-math -I$(DEVKITPRO)/libnx/include/ -fPIE -Wl,--allow-multiple-definition -include $(LIBNX)/include/switch.h |
| 191 | CFLAGS += -specs=$(DEVKITPRO)/libnx/switch.specs -DNO_OS -DNO_DYLIB -DNO_SOCKET -D__arm64__ -D__ARM_NEON__ |
| 192 | CFLAGS += -D__SWITCH__ |
| 193 | CFLAGS += -DARM -D__aarch64__=1 -march=armv8-a -mtune=cortex-a57 -mtp=soft -DHAVE_INTTYPES -DLSB_FIRST -ffast-math -mcpu=cortex-a57+crc+fp+simd -ffunction-sections |
| 194 | CFLAGS += -ftree-vectorize |
| 195 | CFLAGS += -Ifrontend/switch -ftree-vectorize |
| 196 | LIBPTHREAD := |
| 197 | STATIC_LINKING=1 |
| 198 | # Lightning requires rw/rx patches first |
| 199 | DYNAREC := 0 |
| 200 | |
| 201 | # Lakka Switch (arm64) |
| 202 | else ifeq ($(platform), arm64) |
| 203 | TARGET := $(TARGET_NAME)_libretro.so |
| 204 | ARCH := arm64 |
| 205 | DYNAREC = ari64 |
| 206 | BUILTIN_GPU = unai |
| 207 | fpic := -fPIC |
| 208 | CFLAGS := $(filter-out -O2, $(CFLAGS)) |
| 209 | CFLAGS += -O3 -ftree-vectorize |
| 210 | |
| 211 | # Lightweight PS3 Homebrew SDK |
| 212 | else ifeq ($(platform), psl1ght) |
| 213 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 214 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 215 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 216 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 217 | |
| 218 | # PSP |
| 219 | else ifeq ($(platform), psp1) |
| 220 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 221 | CC = psp-gcc$(EXE_EXT) |
| 222 | AR = psp-ar$(EXE_EXT) |
| 223 | CFLAGS += -DPSP -G0 |
| 224 | |
| 225 | # Vita |
| 226 | else ifeq ($(platform), vita) |
| 227 | TARGET := $(TARGET_NAME)_libretro_vita.a |
| 228 | CC = arm-vita-eabi-gcc$(EXE_EXT) |
| 229 | AR = arm-vita-eabi-ar$(EXE_EXT) |
| 230 | CFLAGS += -DVITA |
| 231 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 232 | CFLAGS += -fsingle-precision-constant -mword-relocations -fno-unwind-tables |
| 233 | CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops |
| 234 | CFLAGS += -fno-optimize-sibling-calls |
| 235 | CFLAGS += -I$(VITASDK)/include -Ifrontend/vita |
| 236 | CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB |
| 237 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 238 | |
| 239 | # CFLAGS += -U__ARM_NEON__ |
| 240 | HAVE_NEON = 1 |
| 241 | BUILTIN_GPU = neon |
| 242 | |
| 243 | DYNAREC = ari64 |
| 244 | ARCH = arm |
| 245 | STATIC_LINKING = 1 |
| 246 | |
| 247 | # CTR(3DS) |
| 248 | else ifeq ($(platform), ctr) |
| 249 | TARGET := $(TARGET_NAME)_libretro_ctr.a |
| 250 | CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT) |
| 251 | CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) |
| 252 | AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) |
| 253 | CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET -DTHREAD_ENABLED -DGPU_UNAI_USE_FLOATMATH -DGPU_UNAI_USE_FLOAT_DIV_MULTINV |
| 254 | CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft |
| 255 | CFLAGS += -Wall -mword-relocations |
| 256 | CFLAGS += -fomit-frame-pointer -ffast-math -funroll-loops |
| 257 | CFLAGS += -Ifrontend/3ds -I$(CTRULIB)/include |
| 258 | CFLAGS += -Werror=implicit-function-declaration |
| 259 | CFLAGS += -DHAVE_UNISTD_H |
| 260 | |
| 261 | OBJS += frontend/3ds/utils.o |
| 262 | |
| 263 | # CFLAGS += -DPCSX |
| 264 | BUILTIN_GPU = unai |
| 265 | THREAD_RENDERING = 1 |
| 266 | DYNAREC = ari64 |
| 267 | ARCH = arm |
| 268 | HAVE_NEON = 0 |
| 269 | STATIC_LINKING = 1 |
| 270 | |
| 271 | # Xbox 360 |
| 272 | else ifeq ($(platform), xenon) |
| 273 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
| 274 | CC = xenon-gcc$(EXE_EXT) |
| 275 | AR = xenon-ar$(EXE_EXT) |
| 276 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ |
| 277 | |
| 278 | # Nintendo Game Cube |
| 279 | else ifeq ($(platform), ngc) |
| 280 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
| 281 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 282 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 283 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 284 | |
| 285 | # Nintendo Wii |
| 286 | else ifeq ($(platform), wii) |
| 287 | TARGET := libretro_$(TARGET_NAME)_wii.a |
| 288 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 289 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 290 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 291 | |
| 292 | # QNX |
| 293 | else ifeq ($(platform), qnx) |
| 294 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 295 | fpic := -fPIC |
| 296 | CC = qcc -Vgcc_ntoarmv7le |
| 297 | CC_AS = $(CC) |
| 298 | HAVE_NEON = 1 |
| 299 | DYNAREC = ari64 |
| 300 | BUILTIN_GPU = neon |
| 301 | ARCH = arm |
| 302 | CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 303 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 304 | MAIN_LDLIBS += -lsocket |
| 305 | LIBPTHREAD := |
| 306 | LIBDL := |
| 307 | LIBM := |
| 308 | |
| 309 | #Raspberry Pi 1 |
| 310 | else ifeq ($(platform), rpi1) |
| 311 | TARGET := $(TARGET_NAME)_libretro.so |
| 312 | fpic := -fPIC |
| 313 | CFLAGS += -marm -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard |
| 314 | ASFLAGS += -mcpu=arm1176jzf-s -mfpu=vfp -mfloat-abi=hard |
| 315 | HAVE_NEON = 0 |
| 316 | ARCH = arm |
| 317 | BUILTIN_GPU = unai |
| 318 | DYNAREC = ari64 |
| 319 | |
| 320 | #Raspberry Pi 2 |
| 321 | else ifeq ($(platform), rpi2) |
| 322 | TARGET := $(TARGET_NAME)_libretro.so |
| 323 | fpic := -fPIC |
| 324 | CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
| 325 | ASFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
| 326 | HAVE_NEON = 1 |
| 327 | ARCH = arm |
| 328 | BUILTIN_GPU = neon |
| 329 | DYNAREC = ari64 |
| 330 | |
| 331 | #Raspberry Pi 3 |
| 332 | else ifeq ($(platform), rpi3) |
| 333 | TARGET := $(TARGET_NAME)_libretro.so |
| 334 | fpic := -fPIC |
| 335 | CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 336 | ASFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 337 | HAVE_NEON = 1 |
| 338 | ARCH = arm |
| 339 | BUILTIN_GPU = neon |
| 340 | DYNAREC = ari64 |
| 341 | |
| 342 | #Raspberry Pi 3 with a 64bit GNU/Linux OS |
| 343 | else ifeq ($(platform), rpi3_64) |
| 344 | TARGET := $(TARGET_NAME)_libretro.so |
| 345 | ARCH := arm64 |
| 346 | BUILTIN_GPU = unai |
| 347 | DYNAREC = ari64 |
| 348 | fpic := -fPIC |
| 349 | CFLAGS += -march=armv8-a+crc+simd -mtune=cortex-a53 -ftree-vectorize |
| 350 | |
| 351 | #Raspberry Pi 4 with a 32bit GNU/Linux OS |
| 352 | else ifeq ($(platform), rpi4) |
| 353 | TARGET := $(TARGET_NAME)_libretro.so |
| 354 | fpic := -fPIC |
| 355 | CFLAGS += -marm -mcpu=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 356 | ASFLAGS += -mcpu=cortex-a72 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 357 | HAVE_NEON = 1 |
| 358 | ARCH = arm |
| 359 | BUILTIN_GPU = neon |
| 360 | DYNAREC = ari64 |
| 361 | |
| 362 | #Raspberry Pi 4 with a 64bit GNU/Linux OS |
| 363 | else ifeq ($(platform), rpi4_64) |
| 364 | TARGET := $(TARGET_NAME)_libretro.so |
| 365 | ARCH := arm64 |
| 366 | BUILTIN_GPU = unai |
| 367 | DYNAREC = ari64 |
| 368 | fpic := -fPIC |
| 369 | CFLAGS += -march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize |
| 370 | |
| 371 | # Classic Platforms #################### |
| 372 | # Platform affix = classic_<ISA>_<µARCH> |
| 373 | # Help at https://modmyclassic.com/comp |
| 374 | |
| 375 | # (armv7 a7, hard point, neon based) ### |
| 376 | # NESC, SNESC, C64 mini |
| 377 | else ifeq ($(platform), classic_armv7_a7) |
| 378 | TARGET := $(TARGET_NAME)_libretro.so |
| 379 | fpic := -fPIC |
| 380 | CFLAGS += -Ofast \ |
| 381 | -flto=4 -fwhole-program -fuse-linker-plugin \ |
| 382 | -fdata-sections -ffunction-sections -Wl,--gc-sections \ |
| 383 | -fno-stack-protector -fno-ident -fomit-frame-pointer \ |
| 384 | -falign-functions=1 -falign-jumps=1 -falign-loops=1 \ |
| 385 | -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \ |
| 386 | -fmerge-all-constants -fno-math-errno \ |
| 387 | -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
| 388 | CXXFLAGS += $(CFLAGS) |
| 389 | CPPFLAGS += $(CFLAGS) |
| 390 | ASFLAGS += $(CFLAGS) |
| 391 | HAVE_NEON = 1 |
| 392 | ARCH = arm |
| 393 | BUILTIN_GPU = neon |
| 394 | DYNAREC = ari64 |
| 395 | ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1) |
| 396 | CFLAGS += -march=armv7-a |
| 397 | else |
| 398 | CFLAGS += -march=armv7ve |
| 399 | # If gcc is 5.0 or later |
| 400 | ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1) |
| 401 | LDFLAGS += -static-libgcc -static-libstdc++ |
| 402 | endif |
| 403 | endif |
| 404 | |
| 405 | # (armv8 a35, hard point, neon based) ### |
| 406 | # PlayStation Classic |
| 407 | else ifeq ($(platform), classic_armv8_a35) |
| 408 | TARGET := $(TARGET_NAME)_libretro.so |
| 409 | fpic := -fPIC |
| 410 | CFLAGS += -Ofast \ |
| 411 | -fmerge-all-constants -fno-math-errno -march=armv8-a \ |
| 412 | -marm -mcpu=cortex-a35 -mtune=cortex-a35 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 413 | HAVE_NEON = 1 |
| 414 | ARCH = arm |
| 415 | BUILTIN_GPU = neon |
| 416 | DYNAREC = ari64 |
| 417 | LDFLAGS += -static-libgcc -static-libstdc++ -fPIC |
| 418 | |
| 419 | ####################################### |
| 420 | |
| 421 | # ARM |
| 422 | else ifneq (,$(findstring armv,$(platform))) |
| 423 | TARGET := $(TARGET_NAME)_libretro.so |
| 424 | fpic := -fPIC |
| 425 | HAVE_NEON = 0 |
| 426 | BUILTIN_GPU = peops |
| 427 | ifneq (,$(findstring cortexa8,$(platform))) |
| 428 | CFLAGS += -marm -mcpu=cortex-a8 |
| 429 | ASFLAGS += -mcpu=cortex-a8 |
| 430 | else ifneq (,$(findstring cortexa7,$(platform))) |
| 431 | CFLAGS += -marm -mcpu=cortex-a7 |
| 432 | ASFLAGS += -mcpu=cortex-a7 |
| 433 | LIBZ := |
| 434 | else ifneq (,$(findstring cortexa9,$(platform))) |
| 435 | CFLAGS += -marm -mcpu=cortex-a9 |
| 436 | ASFLAGS += -mcpu=cortex-a9 |
| 437 | endif |
| 438 | CFLAGS += -marm |
| 439 | ifneq (,$(findstring neon,$(platform))) |
| 440 | CFLAGS += -mfpu=neon |
| 441 | ASFLAGS += -mfpu=neon |
| 442 | HAVE_NEON = 1 |
| 443 | BUILTIN_GPU = neon |
| 444 | endif |
| 445 | ifneq (,$(findstring softfloat,$(platform))) |
| 446 | CFLAGS += -mfloat-abi=softfp |
| 447 | ASFLAGS += -mfloat-abi=softfp |
| 448 | else ifneq (,$(findstring hardfloat,$(platform))) |
| 449 | CFLAGS += -mfloat-abi=hard |
| 450 | ASFLAGS += -mfloat-abi=hard |
| 451 | endif |
| 452 | ARCH = arm |
| 453 | DYNAREC = ari64 |
| 454 | |
| 455 | else ifeq ($(platform), miyoo) |
| 456 | TARGET := $(TARGET_NAME)_libretro.so |
| 457 | CC = /opt/miyoo/usr/bin/arm-linux-gcc |
| 458 | CXX = /opt/miyoo/usr/bin/arm-linux-g++ |
| 459 | fpic := -fPIC |
| 460 | CFLAGS += -mcpu=arm926ej-s -fsingle-precision-constant |
| 461 | CFLAGS += -DGPULIB_USE_MMAP -DGPU_UNAI_USE_INT_DIV_MULTINV -D_MIYOO |
| 462 | ARCH = arm |
| 463 | BUILTIN_GPU = unai |
| 464 | DYNAREC = ari64 |
| 465 | HAVE_NEON = 0 |
| 466 | |
| 467 | # Emscripten |
| 468 | else ifeq ($(platform), emscripten) |
| 469 | TARGET := $(TARGET_NAME)_libretro_$(platform).bc |
| 470 | fpic := -fPIC |
| 471 | SHARED := -shared -Wl,--no-undefined -Wl,--version-script=link.T |
| 472 | CFLAGS += -DNO_DYLIB -DNO_SOCKET |
| 473 | STATIC_LINKING = 1 |
| 474 | |
| 475 | # Windows |
| 476 | else |
| 477 | TARGET := $(TARGET_NAME)_libretro.dll |
| 478 | BUILTIN_GPU = peops |
| 479 | PLATFORM = libretro |
| 480 | MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s |
| 481 | CFLAGS += -D__WIN32__ -DNO_DYLIB |
| 482 | MMAP_WIN32=1 |
| 483 | MAIN_LDLIBS += -lws2_32 |
| 484 | LIBPTHREAD := |
| 485 | LIBDL := |
| 486 | LIBM := |
| 487 | USE_LIBRETRO_VFS = 1 |
| 488 | endif |
| 489 | |
| 490 | CFLAGS += $(fpic) |
| 491 | MAIN_LDFLAGS += -shared |
| 492 | MAIN_LDLIBS += $(LIBPTHREAD) $(LIBM) $(LIBDL) $(LIBZ) |
| 493 | |
| 494 | # enable large file support if available |
| 495 | ifeq ($(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h | grep __SIZEOF_LONG__ | awk '{print $$3}'),4) |
| 496 | CFLAGS += -D_FILE_OFFSET_BITS=64 |
| 497 | endif |
| 498 | |
| 499 | # try to autodetect stuff for the lazy |
| 500 | ifndef ARCH |
| 501 | ARCH = $(ARCH_DETECTED) |
| 502 | endif |
| 503 | ifndef HAVE_NEON |
| 504 | HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0) |
| 505 | endif |
| 506 | ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) |
| 507 | MAIN_LDFLAGS += -Wl,--no-undefined |
| 508 | endif |
| 509 | ifdef ALLOW_LIGHTREC_ON_ARM |
| 510 | CFLAGS += -DALLOW_LIGHTREC_ON_ARM |
| 511 | endif |
| 512 | |
| 513 | TARGET ?= libretro.so |
| 514 | PLATFORM = libretro |
| 515 | BUILTIN_GPU ?= peops |
| 516 | SOUND_DRIVERS = libretro |
| 517 | PLUGINS = |
| 518 | NO_CONFIG_MAK = yes |
| 519 | |
| 520 | # what does this do |
| 521 | #libretro_all: all |
| 522 | #ifeq ($(platform),ios) |
| 523 | #ifeq ($(DYNAREC),1) |
| 524 | # make -f Makefile.libretro DYNAREC=0 platform=$(platform) clean |
| 525 | # make -f Makefile.libretro DYNAREC=0 platform=$(platform) |
| 526 | #endif |
| 527 | #endif |
| 528 | |
| 529 | include Makefile |
| 530 | |
| 531 | # no special AS needed for gpu_neon |
| 532 | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S |
| 533 | $(CC) $(CFLAGS) -c $^ -o $@ |