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