1 # Makefile for PCSX ReARMed (libretro)
7 ifeq ($(shell uname -a),)
9 else ifneq ($(findstring MINGW,$(shell uname -a)),)
11 else ifneq ($(findstring Darwin,$(shell uname -a)),)
13 else ifneq ($(findstring win,$(shell uname -a)),)
24 TARGET_NAME := pcsx_rearmed
25 GIT_VERSION := " $(shell git rev-parse --short HEAD || echo unknown)"
26 ifneq ($(GIT_VERSION)," unknown")
27 CFLAGS += -DGIT_VERSION=\"$(GIT_VERSION)\"
30 LIBPTHREAD := -lpthread
36 ifeq ($(platform), unix)
37 TARGET := $(TARGET_NAME)_libretro.so
40 else ifeq ($(platform), linux-portable)
41 TARGET := $(TARGET_NAME)_libretro.so
42 fpic := -fPIC -nostdlib
43 EXTRA_LDFLAGS += -fPIC -nostdlib
50 else ifeq ($(platform), osx)
51 TARGET := $(TARGET_NAME)_libretro.dylib
53 fpic += -mmacosx-version-min=10.1
56 else ifeq ($(platform),$(filter $(platform),ios9 ios-arm64))
61 TARGET := $(TARGET_NAME)_libretro_ios.dylib
63 else ifneq (,$(findstring ios,$(platform)))
68 TARGET := $(TARGET_NAME)_libretro_ios.dylib
69 ifeq ($(USE_DYNAREC),0)
71 TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib
76 IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
79 CC = clang -arch armv7 -isysroot $(IOSSDK)
80 CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
81 CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
82 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
83 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
85 ifeq ($(platform),ios9)
86 CC += -miphoneos-version-min=8.0
87 CXX += -miphoneos-version-min=8.0
88 CC_AS += -miphoneos-version-min=8.0
89 CFLAGS += -miphoneos-version-min=8.0
91 CC += -miphoneos-version-min=5.0
92 CXX += -miphoneos-version-min=5.0
93 CC_AS += -miphoneos-version-min=5.0
94 CFLAGS += -miphoneos-version-min=5.0
98 else ifeq ($(platform), ps3)
99 TARGET := $(TARGET_NAME)_libretro_ps3.a
100 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
101 AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
102 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
105 else ifeq ($(platform), sncps3)
106 TARGET := $(TARGET_NAME)_libretro_ps3.a
107 CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
108 AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
109 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
111 # Lightweight PS3 Homebrew SDK
112 else ifeq ($(platform), psl1ght)
113 TARGET := $(TARGET_NAME)_libretro_psl1ght.a
114 CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
115 AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
116 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
119 else ifeq ($(platform), psp1)
120 TARGET := $(TARGET_NAME)_libretro_psp1.a
121 CC = psp-gcc$(EXE_EXT)
122 AR = psp-ar$(EXE_EXT)
126 else ifeq ($(platform), vita)
127 TARGET := $(TARGET_NAME)_libretro_vita.a
128 CC = arm-vita-eabi-gcc$(EXE_EXT)
129 AR = arm-vita-eabi-ar$(EXE_EXT)
131 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
132 CFLAGS += -fsingle-precision-constant -mword-relocations -fno-unwind-tables
133 CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops
134 CFLAGS += -fno-optimize-sibling-calls
135 CFLAGS += -I$(VITASDK)/include -Ifrontend/vita
136 CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB
137 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
139 # CFLAGS += -U__ARM_NEON__
150 else ifeq ($(platform), ctr)
151 TARGET := $(TARGET_NAME)_libretro_ctr.a
152 CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
153 CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
154 AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
155 CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET
156 CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
157 CFLAGS += -Wall -mword-relocations
158 CFLAGS += -fomit-frame-pointer -ffast-math
159 CFLAGS += -Ifrontend/3ds
160 CFLAGS += -Werror=implicit-function-declaration
172 else ifeq ($(platform), xenon)
173 TARGET := $(TARGET_NAME)_libretro_xenon360.a
174 CC = xenon-gcc$(EXE_EXT)
175 AR = xenon-ar$(EXE_EXT)
176 CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
179 else ifeq ($(platform), ngc)
180 TARGET := $(TARGET_NAME)_libretro_ngc.a
181 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
182 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
183 CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
186 else ifeq ($(platform), wii)
187 TARGET := libretro_$(TARGET_NAME)_wii.a
188 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
189 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
190 CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
193 else ifeq ($(platform), qnx)
194 TARGET := $(TARGET_NAME)_libretro_qnx.so
196 CC = qcc -Vgcc_ntoarmv7le
203 CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp
204 ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
205 MAIN_LDLIBS += -lsocket
210 else ifeq ($(platform), rpi2)
211 TARGET := $(TARGET_NAME)_libretro.so
213 CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
214 ASFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
221 else ifeq ($(platform), rpi3)
222 TARGET := $(TARGET_NAME)_libretro.so
224 CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
225 ASFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
232 else ifneq (,$(findstring armv,$(platform)))
233 TARGET := $(TARGET_NAME)_libretro.so
236 ifneq (,$(findstring cortexa8,$(platform)))
237 CFLAGS += -marm -mcpu=cortex-a8
238 ASFLAGS += -mcpu=cortex-a8
239 else ifneq (,$(findstring cortexa9,$(platform)))
240 CFLAGS += -marm -mcpu=cortex-a9
241 ASFLAGS += -mcpu=cortex-a9
244 ifneq (,$(findstring neon,$(platform)))
246 ASFLAGS += -mfpu=neon
250 ifneq (,$(findstring softfloat,$(platform)))
251 CFLAGS += -mfloat-abi=softfp
252 ASFLAGS += -mfloat-abi=softfp
253 else ifneq (,$(findstring hardfloat,$(platform)))
254 CFLAGS += -mfloat-abi=hard
255 ASFLAGS += -mfloat-abi=hard
262 TARGET := $(TARGET_NAME)_libretro.dll
265 MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s
266 CFLAGS += -D__WIN32__ -DNO_DYLIB
268 MAIN_LDLIBS += -lws2_32
274 MAIN_LDFLAGS += -shared
275 MAIN_LDLIBS += $(LIBPTHREAD) $(LIBDL) $(LIBZ)
277 # try to autodetect stuff for the lazy
279 ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}')
282 HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0)
284 ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU)
285 MAIN_LDFLAGS += -Wl,--no-undefined
288 # try to autodetect stuff for the lazy
290 ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}')
293 HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0)
295 ifeq ($(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU)
296 MAIN_LDFLAGS += -Wl,--no-undefined
299 TARGET ?= libretro.so
302 SOUND_DRIVERS = libretro
307 ifeq ($(platform),ios)
308 ifeq ($(USE_DYNAREC),1)
309 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) clean
310 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform)
316 # no special AS needed for gpu_neon
317 plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
318 $(CC) $(CFLAGS) -c $^ -o $@