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