Commit | Line | Data |
---|---|---|
706252fc | 1 | # Makefile for PCSX ReARMed (libretro) |
2 | ||
a9422018 HH |
3 | DEBUG ?= 0 |
4 | WANT_ZLIB ?= 1 | |
9b400da1 | 5 | |
1c6ab616 | 6 | ifeq ($(platform),) |
fb01e82a | 7 | platform = unix |
8 | ifeq ($(shell uname -a),) | |
9 | platform = win | |
10 | else ifneq ($(findstring MINGW,$(shell uname -a)),) | |
11 | platform = win | |
12 | else ifneq ($(findstring Darwin,$(shell uname -a)),) | |
13 | platform = osx | |
14 | else ifneq ($(findstring win,$(shell uname -a)),) | |
15 | platform = win | |
16 | endif | |
1c6ab616 | 17 | endif |
18 | ||
a4874585 C |
19 | CC ?= gcc |
20 | CXX ?= g++ | |
21 | AS ?= as | |
8ad07683 | 22 | CC_AS ?= $(CC) |
b09a1d34 | 23 | CFLAGS ?= |
1c6ab616 | 24 | |
468564e2 | 25 | TARGET_NAME := pcsx_rearmed |
8fc5171a GR |
26 | GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)" |
27 | ifneq ($(GIT_VERSION)," unknown") | |
28 | CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\" | |
29 | endif | |
7795edd6 | 30 | ifneq ($(WANT_ZLIB),1) |
917a47e0 | 31 | LIBZ := -lz |
7795edd6 | 32 | endif |
917a47e0 | 33 | LIBPTHREAD := -lpthread |
2085a865 | 34 | ifneq ($(findstring Haiku,$(shell uname -s)),) |
35 | LIBDL := -lroot -lnetwork | |
36 | else | |
8356146f | 37 | LIBDL := -ldl |
2085a865 | 38 | endif |
958c9818 | 39 | LIBM := -lm |
a9422018 | 40 | MMAP_WIN32 = 0 |
917a47e0 | 41 | EXTRA_LDFLAGS = |
ce0e7ac9 | 42 | |
fb01e82a | 43 | # Unix |
1c6ab616 | 44 | ifeq ($(platform), unix) |
fb01e82a | 45 | TARGET := $(TARGET_NAME)_libretro.so |
46 | fpic := -fPIC | |
2085a865 | 47 | ifneq ($(findstring SunOS,$(shell uname -s)),) |
cf1d58b3 | 48 | CC = gcc |
49 | endif | |
4abd2871 HH |
50 | ifeq ($(ARCH), arm) |
51 | ifneq ($(findstring __thumb__,$(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h)),) | |
52 | # must disable thumb as recompiler can't handle it | |
53 | CFLAGS += -marm | |
54 | endif | |
55 | endif | |
fb01e82a | 56 | |
917a47e0 | 57 | else ifeq ($(platform), linux-portable) |
58 | TARGET := $(TARGET_NAME)_libretro.so | |
59 | fpic := -fPIC -nostdlib | |
60 | EXTRA_LDFLAGS += -fPIC -nostdlib | |
917a47e0 | 61 | LIBZ := |
62 | LIBPTHREAD := | |
63 | LIBDL := | |
958c9818 | 64 | LIBM := |
95527e35 | 65 | NO_UNDEF_CHECK = 1 |
66 | ||
fb01e82a | 67 | # OS X |
1c6ab616 | 68 | else ifeq ($(platform), osx) |
c8c2bdfe | 69 | USE_DYNAREC ?= 1 |
fb01e82a | 70 | TARGET := $(TARGET_NAME)_libretro.dylib |
71 | fpic := -fPIC | |
33b82111 | 72 | fpic += -mmacosx-version-min=10.1 |
c8c2bdfe | 73 | ifeq ($(USE_DYNAREC),0) |
74 | # Override | |
75 | TARGET := $(TARGET_NAME)_interpreter_libretro.dylib | |
76 | endif | |
fb01e82a | 77 | |
78 | # iOS | |
aab1b446 | 79 | else ifeq ($(platform),$(filter $(platform),ios-arm64)) |
a9422018 HH |
80 | ARCH := arm64 |
81 | USE_DYNAREC = 0 | |
82 | HAVE_NEON = 0 | |
83 | BUILTIN_GPU = peops | |
84 | TARGET := $(TARGET_NAME)_libretro_ios.dylib | |
8fb0f7c5 | 85 | |
5c166f37 | 86 | else ifneq (,$(findstring ios,$(platform))) |
fb01e82a | 87 | ARCH := arm |
cbf0ed57 | 88 | USE_DYNAREC ?= 1 |
c8c2bdfe | 89 | HAVE_NEON = 1 |
90 | BUILTIN_GPU = neon | |
fb01e82a | 91 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
3bc0af70 | 92 | ifeq ($(USE_DYNAREC),0) |
cbf0ed57 JC |
93 | # Override |
94 | TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib | |
95 | endif | |
fb01e82a | 96 | fpic := -fPIC |
1c6ab616 | 97 | |
fb01e82a | 98 | ifeq ($(IOSSDK),) |
d45e563f | 99 | IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) |
fb01e82a | 100 | endif |
ac86f051 | 101 | |
fb01e82a | 102 | CC = clang -arch armv7 -isysroot $(IOSSDK) |
103 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) | |
104 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) | |
105 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm | |
106 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon | |
fb01e82a | 107 | CFLAGS += -DIOS |
5c166f37 | 108 | ifeq ($(platform),ios9) |
109 | CC += -miphoneos-version-min=8.0 | |
110 | CXX += -miphoneos-version-min=8.0 | |
111 | CC_AS += -miphoneos-version-min=8.0 | |
112 | CFLAGS += -miphoneos-version-min=8.0 | |
113 | else | |
114 | CC += -miphoneos-version-min=5.0 | |
115 | CXX += -miphoneos-version-min=5.0 | |
116 | CC_AS += -miphoneos-version-min=5.0 | |
117 | CFLAGS += -miphoneos-version-min=5.0 | |
118 | endif | |
fb01e82a | 119 | |
120 | # PS3 | |
1c6ab616 | 121 | else ifeq ($(platform), ps3) |
fb01e82a | 122 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
123 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe | |
124 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe | |
125 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
126 | ||
127 | # sncps3 | |
1c6ab616 | 128 | else ifeq ($(platform), sncps3) |
fb01e82a | 129 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
130 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe | |
131 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe | |
132 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
133 | ||
134 | # Lightweight PS3 Homebrew SDK | |
1c6ab616 | 135 | else ifeq ($(platform), psl1ght) |
fb01e82a | 136 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
137 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) | |
138 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) | |
139 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
140 | ||
141 | # PSP | |
1c6ab616 | 142 | else ifeq ($(platform), psp1) |
93305561 | 143 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
1c6ab616 | 144 | CC = psp-gcc$(EXE_EXT) |
145 | AR = psp-ar$(EXE_EXT) | |
146 | CFLAGS += -DPSP -G0 | |
fb01e82a | 147 | |
c90258c8 | 148 | # Vita |
149 | else ifeq ($(platform), vita) | |
150 | TARGET := $(TARGET_NAME)_libretro_vita.a | |
151 | CC = arm-vita-eabi-gcc$(EXE_EXT) | |
152 | AR = arm-vita-eabi-ar$(EXE_EXT) | |
153 | CFLAGS += -DVITA | |
154 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm | |
778ad9ce | 155 | CFLAGS += -fsingle-precision-constant -mword-relocations -fno-unwind-tables |
73081f23 | 156 | CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops |
a9422018 | 157 | CFLAGS += -fno-optimize-sibling-calls |
c4052f4d | 158 | CFLAGS += -I$(VITASDK)/include -Ifrontend/vita |
159 | CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB | |
c90258c8 | 160 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
c4052f4d | 161 | |
95527e35 | 162 | # CFLAGS += -U__ARM_NEON__ |
c90258c8 | 163 | HAVE_NEON = 1 |
164 | BUILTIN_GPU = neon | |
165 | ||
0702a1f3 | 166 | USE_DYNAREC = 1 |
1cc8c854 | 167 | DRC_CACHE_BASE = 0 |
c4052f4d | 168 | |
169 | ARCH = arm | |
95527e35 | 170 | STATIC_LINKING = 1 |
c4052f4d | 171 | |
fc99395c | 172 | # CTR(3DS) |
173 | else ifeq ($(platform), ctr) | |
174 | TARGET := $(TARGET_NAME)_libretro_ctr.a | |
175 | CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT) | |
176 | CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) | |
177 | AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) | |
f72db18e | 178 | CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET |
179 | CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft | |
fc99395c | 180 | CFLAGS += -Wall -mword-relocations |
778ad9ce | 181 | CFLAGS += -fomit-frame-pointer -ffast-math |
f72db18e | 182 | CFLAGS += -Ifrontend/3ds |
fc99395c | 183 | CFLAGS += -Werror=implicit-function-declaration |
184 | ||
fc99395c | 185 | # CFLAGS += -DPCSX |
3becfa56 | 186 | # BUILTIN_GPU = unai |
fc99395c | 187 | USE_DYNAREC = 1 |
9508b4c7 | 188 | DRC_CACHE_BASE = 0 |
fc99395c | 189 | ARCH = arm |
86cf0ab7 | 190 | HAVE_NEON = 0 |
fc99395c | 191 | |
192 | STATIC_LINKING = 1 | |
193 | ||
fb01e82a | 194 | # Xbox 360 |
1c6ab616 | 195 | else ifeq ($(platform), xenon) |
fb01e82a | 196 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
197 | CC = xenon-gcc$(EXE_EXT) | |
198 | AR = xenon-ar$(EXE_EXT) | |
199 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ | |
200 | ||
201 | # Nintendo Game Cube | |
1c6ab616 | 202 | else ifeq ($(platform), ngc) |
fb01e82a | 203 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
204 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) | |
205 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) | |
206 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
207 | ||
208 | # Nintendo Wii | |
1c6ab616 | 209 | else ifeq ($(platform), wii) |
fb01e82a | 210 | TARGET := libretro_$(TARGET_NAME)_wii.a |
211 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) | |
212 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) | |
213 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
214 | ||
215 | # QNX | |
a4874585 | 216 | else ifeq ($(platform), qnx) |
fb01e82a | 217 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
ea13a2f2 | 218 | fpic := -fPIC |
fb01e82a | 219 | CC = qcc -Vgcc_ntoarmv7le |
220 | CC_AS = $(CC) | |
221 | HAVE_NEON = 1 | |
222 | USE_DYNAREC = 1 | |
223 | DRC_CACHE_BASE = 0 | |
224 | BUILTIN_GPU = neon | |
225 | ARCH = arm | |
1e212a25 | 226 | CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
a9422018 | 227 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
95527e35 | 228 | MAIN_LDLIBS += -lsocket |
229 | LIBPTHREAD := | |
230 | LIBDL := | |
958c9818 | 231 | LIBM := |
fb01e82a | 232 | |
ea13a2f2 LM |
233 | #Raspberry Pi 2 |
234 | else ifeq ($(platform), rpi2) | |
235 | TARGET := $(TARGET_NAME)_libretro.so | |
236 | fpic := -fPIC | |
ea13a2f2 | 237 | CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
f125f441 | 238 | ASFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
ea13a2f2 LM |
239 | HAVE_NEON = 1 |
240 | ARCH = arm | |
241 | BUILTIN_GPU = neon | |
242 | USE_DYNAREC = 1 | |
778ad9ce | 243 | |
46ffb580 LM |
244 | #Raspberry Pi 3 |
245 | else ifeq ($(platform), rpi3) | |
246 | TARGET := $(TARGET_NAME)_libretro.so | |
247 | fpic := -fPIC | |
46ffb580 LM |
248 | CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
249 | ASFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard | |
250 | HAVE_NEON = 1 | |
251 | ARCH = arm | |
252 | BUILTIN_GPU = neon | |
253 | USE_DYNAREC = 1 | |
ea13a2f2 | 254 | |
d28150f7 RSH |
255 | # Classic Platforms #################### |
256 | # Platform affix = classic_<ISA>_<µARCH> | |
166f75f0 | 257 | # Help at https://modmyclassic.com/comp |
d28150f7 RSH |
258 | |
259 | # (armv7 a7, hard point, neon based) ### | |
260 | # NESC, SNESC, C64 mini | |
261 | else ifeq ($(platform), classic_armv7_a7) | |
262 | TARGET := $(TARGET_NAME)_libretro.so | |
263 | fpic := -fPIC | |
264 | CFLAGS += -Ofast \ | |
265 | -flto=4 -fwhole-program -fuse-linker-plugin \ | |
266 | -fdata-sections -ffunction-sections -Wl,--gc-sections \ | |
267 | -fno-stack-protector -fno-ident -fomit-frame-pointer \ | |
268 | -falign-functions=1 -falign-jumps=1 -falign-loops=1 \ | |
269 | -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-unroll-loops \ | |
270 | -fmerge-all-constants -fno-math-errno \ | |
10a39de1 | 271 | -marm -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
166f75f0 RSH |
272 | CXXFLAGS += $(CFLAGS) |
273 | CPPFLAGS += $(CFLAGS) | |
d28150f7 RSH |
274 | ASFLAGS += $(CFLAGS) |
275 | HAVE_NEON = 1 | |
276 | ARCH = arm | |
277 | BUILTIN_GPU = neon | |
278 | USE_DYNAREC = 1 | |
10a39de1 | 279 | ifeq ($(shell echo `$(CC) -dumpversion` "< 4.9" | bc -l), 1) |
a9422018 | 280 | CFLAGS += -march=armv7-a |
10a39de1 | 281 | else |
a9422018 HH |
282 | CFLAGS += -march=armv7ve |
283 | # If gcc is 5.0 or later | |
284 | ifeq ($(shell echo `$(CC) -dumpversion` ">= 5" | bc -l), 1) | |
285 | LDFLAGS += -static-libgcc -static-libstdc++ | |
286 | endif | |
10a39de1 | 287 | endif |
5ffd1f23 WS |
288 | |
289 | # (armv8 a35, hard point, neon based) ### | |
290 | # PlayStation Classic | |
291 | else ifeq ($(platform), classic_armv8_a35) | |
292 | TARGET := $(TARGET_NAME)_libretro.so | |
293 | fpic := -fPIC | |
294 | CFLAGS += -marm -mtune=cortex-a35 -mfpu=neon-fp-armv8 -mfloat-abi=hard | |
295 | HAVE_NEON = 1 | |
296 | ARCH = arm | |
297 | BUILTIN_GPU = neon | |
298 | USE_DYNAREC = 1 | |
299 | CFLAGS += -march=armv8-a | |
300 | LDFLAGS += -static-libgcc -static-libstdc++ -fPIC | |
301 | ||
d28150f7 RSH |
302 | ####################################### |
303 | ||
fb01e82a | 304 | # ARM |
1af4c281 | 305 | else ifneq (,$(findstring armv,$(platform))) |
fb01e82a | 306 | TARGET := $(TARGET_NAME)_libretro.so |
53919f9e | 307 | fpic := -fPIC |
2cf8d379 | 308 | HAVE_NEON = 0 |
fb01e82a | 309 | DRC_CACHE_BASE = 0 |
2cf8d379 | 310 | BUILTIN_GPU = peops |
fb01e82a | 311 | ifneq (,$(findstring cortexa8,$(platform))) |
312 | CFLAGS += -marm -mcpu=cortex-a8 | |
313 | ASFLAGS += -mcpu=cortex-a8 | |
77aa1e8a A |
314 | else ifneq (,$(findstring cortexa7,$(platform))) |
315 | CFLAGS += -marm -mcpu=cortex-a7 | |
316 | ASFLAGS += -mcpu=cortex-a7 | |
17d0c85f | 317 | LIBZ := |
fb01e82a | 318 | else ifneq (,$(findstring cortexa9,$(platform))) |
319 | CFLAGS += -marm -mcpu=cortex-a9 | |
320 | ASFLAGS += -mcpu=cortex-a9 | |
321 | endif | |
322 | CFLAGS += -marm | |
323 | ifneq (,$(findstring neon,$(platform))) | |
324 | CFLAGS += -mfpu=neon | |
325 | ASFLAGS += -mfpu=neon | |
326 | HAVE_NEON = 1 | |
327 | BUILTIN_GPU = neon | |
328 | endif | |
329 | ifneq (,$(findstring softfloat,$(platform))) | |
330 | CFLAGS += -mfloat-abi=softfp | |
331 | ASFLAGS += -mfloat-abi=softfp | |
332 | else ifneq (,$(findstring hardfloat,$(platform))) | |
333 | CFLAGS += -mfloat-abi=hard | |
334 | ASFLAGS += -mfloat-abi=hard | |
335 | endif | |
336 | ARCH = arm | |
53919f9e | 337 | USE_DYNAREC = 1 |
fb01e82a | 338 | |
339 | # Windows | |
1c6ab616 | 340 | else |
fb01e82a | 341 | TARGET := $(TARGET_NAME)_libretro.dll |
a9422018 HH |
342 | BUILTIN_GPU = peops |
343 | PLATFORM = libretro | |
95527e35 | 344 | MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s |
778ad9ce | 345 | CFLAGS += -D__WIN32__ -DNO_DYLIB |
fb01e82a | 346 | MMAP_WIN32=1 |
95527e35 | 347 | MAIN_LDLIBS += -lws2_32 |
348 | LIBPTHREAD := | |
349 | LIBDL := | |
958c9818 | 350 | LIBM := |
1c6ab616 | 351 | endif |
352 | ||
c4052f4d | 353 | CFLAGS += $(fpic) |
9aff1963 | 354 | MAIN_LDFLAGS += -shared |
958c9818 | 355 | MAIN_LDLIBS += $(LIBPTHREAD) $(LIBM) $(LIBDL) $(LIBZ) |
706252fc | 356 | |
99a5a336 HH |
357 | # enable large file support if available |
358 | ifeq ($(shell $(CC) -E -dD $(CFLAGS) include/arm_features.h | grep __SIZEOF_LONG__ | awk '{print $$3}'),4) | |
359 | CFLAGS += -D_FILE_OFFSET_BITS=64 | |
360 | endif | |
361 | ||
4e0771f5 | 362 | # try to autodetect stuff for the lazy |
363 | ifndef ARCH | |
364 | ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}') | |
365 | endif | |
366 | ifndef HAVE_NEON | |
367 | HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0) | |
368 | endif | |
95527e35 | 369 | ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) |
4e0771f5 | 370 | MAIN_LDFLAGS += -Wl,--no-undefined |
371 | endif | |
372 | ||
a4874585 | 373 | TARGET ?= libretro.so |
706252fc | 374 | PLATFORM = libretro |
a4874585 | 375 | BUILTIN_GPU ?= peops |
706252fc | 376 | SOUND_DRIVERS = libretro |
9aff1963 | 377 | PLUGINS = |
378 | NO_CONFIG_MAK = yes | |
706252fc | 379 | |
3bc0af70 | 380 | # what does this do |
381 | #libretro_all: all | |
382 | #ifeq ($(platform),ios) | |
383 | #ifeq ($(USE_DYNAREC),1) | |
384 | # make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) clean | |
385 | # make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) | |
386 | #endif | |
387 | #endif | |
cbf0ed57 | 388 | |
9aff1963 | 389 | include Makefile |
cd230693 | 390 | |
af32009f | 391 | # no special AS needed for gpu_neon |
392 | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S | |
393 | $(CC) $(CFLAGS) -c $^ -o $@ |