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