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