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
26 LIBPTHREAD := -lpthread
32 ifeq ($(platform), unix)
33 TARGET := $(TARGET_NAME)_libretro.so
36 else ifeq ($(platform), linux-portable)
37 TARGET := $(TARGET_NAME)_libretro.so
38 fpic := -fPIC -nostdlib
39 EXTRA_LDFLAGS += -fPIC -nostdlib
46 else ifeq ($(platform), osx)
47 TARGET := $(TARGET_NAME)_libretro.dylib
49 fpic += -mmacosx-version-min=10.1
52 else ifneq (,$(findstring ios,$(platform)))
55 TARGET := $(TARGET_NAME)_libretro_ios.dylib
56 ifeq ($(USE_DYNAREC),0)
58 TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib
63 IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
66 CC = clang -arch armv7 -isysroot $(IOSSDK)
67 CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
68 CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
69 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
70 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
74 ifeq ($(platform),ios9)
75 CC += -miphoneos-version-min=8.0
76 CXX += -miphoneos-version-min=8.0
77 CC_AS += -miphoneos-version-min=8.0
78 CFLAGS += -miphoneos-version-min=8.0
80 CC += -miphoneos-version-min=5.0
81 CXX += -miphoneos-version-min=5.0
82 CC_AS += -miphoneos-version-min=5.0
83 CFLAGS += -miphoneos-version-min=5.0
87 else ifeq ($(platform), ps3)
88 TARGET := $(TARGET_NAME)_libretro_ps3.a
89 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
90 AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
91 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
94 else ifeq ($(platform), sncps3)
95 TARGET := $(TARGET_NAME)_libretro_ps3.a
96 CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
97 AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
98 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
100 # Lightweight PS3 Homebrew SDK
101 else ifeq ($(platform), psl1ght)
102 TARGET := $(TARGET_NAME)_libretro_psl1ght.a
103 CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
104 AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
105 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
108 else ifeq ($(platform), psp1)
109 TARGET := $(TARGET_NAME)_libretro_psp1.a
110 CC = psp-gcc$(EXE_EXT)
111 AR = psp-ar$(EXE_EXT)
115 else ifeq ($(platform), vita)
116 TARGET := $(TARGET_NAME)_libretro_vita.a
117 CC = arm-vita-eabi-gcc$(EXE_EXT)
118 AR = arm-vita-eabi-ar$(EXE_EXT)
120 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
121 CFLAGS += -fsingle-precision-constant -mword-relocations -fno-unwind-tables
122 CFLAGS += -fno-asynchronous-unwind-tables -ftree-vectorize -funroll-loops
123 CFLAGS += -fno-optimize-sibling-calls
124 CFLAGS += -I$(VITASDK)/include -Ifrontend/vita
125 CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB
126 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
128 # CFLAGS += -U__ARM_NEON__
139 else ifeq ($(platform), ctr)
140 TARGET := $(TARGET_NAME)_libretro_ctr.a
141 CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
142 CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
143 AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
144 CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET
145 CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
146 CFLAGS += -Wall -mword-relocations
147 CFLAGS += -fomit-frame-pointer -ffast-math
148 CFLAGS += -Ifrontend/3ds
149 CFLAGS += -Werror=implicit-function-declaration
160 else ifeq ($(platform), xenon)
161 TARGET := $(TARGET_NAME)_libretro_xenon360.a
162 CC = xenon-gcc$(EXE_EXT)
163 AR = xenon-ar$(EXE_EXT)
164 CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
167 else ifeq ($(platform), ngc)
168 TARGET := $(TARGET_NAME)_libretro_ngc.a
169 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
170 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
171 CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
174 else ifeq ($(platform), wii)
175 TARGET := libretro_$(TARGET_NAME)_wii.a
176 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
177 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
178 CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
181 else ifeq ($(platform), qnx)
182 TARGET := $(TARGET_NAME)_libretro_qnx.so
184 CC = qcc -Vgcc_ntoarmv7le
191 CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp
192 ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
193 MAIN_LDLIBS += -lsocket
198 else ifeq ($(platform), rpi2)
199 TARGET := $(TARGET_NAME)_libretro.so
201 CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
202 ASFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard
209 else ifeq ($(platform), rpi3)
210 TARGET := $(TARGET_NAME)_libretro.so
212 CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
213 ASFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard
220 else ifneq (,$(findstring armv,$(platform)))
221 TARGET := $(TARGET_NAME)_libretro.so
224 ifneq (,$(findstring cortexa8,$(platform)))
225 CFLAGS += -marm -mcpu=cortex-a8
226 ASFLAGS += -mcpu=cortex-a8
227 else ifneq (,$(findstring cortexa9,$(platform)))
228 CFLAGS += -marm -mcpu=cortex-a9
229 ASFLAGS += -mcpu=cortex-a9
232 ifneq (,$(findstring neon,$(platform)))
234 ASFLAGS += -mfpu=neon
238 ifneq (,$(findstring softfloat,$(platform)))
239 CFLAGS += -mfloat-abi=softfp
240 ASFLAGS += -mfloat-abi=softfp
241 else ifneq (,$(findstring hardfloat,$(platform)))
242 CFLAGS += -mfloat-abi=hard
243 ASFLAGS += -mfloat-abi=hard
250 TARGET := $(TARGET_NAME)_libretro.dll
251 MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s
252 CFLAGS += -D__WIN32__
254 MAIN_LDLIBS += -lws2_32
260 MAIN_LDFLAGS += -shared
261 MAIN_LDLIBS += $(LIBPTHREAD) $(LIBDL) $(LIBZ)
263 # try to autodetect stuff for the lazy
265 ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}')
268 HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0)
270 ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU)
271 MAIN_LDFLAGS += -Wl,--no-undefined
274 # try to autodetect stuff for the lazy
276 ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}')
279 HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0)
281 ifeq ($(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU)
282 MAIN_LDFLAGS += -Wl,--no-undefined
285 TARGET ?= libretro.so
288 SOUND_DRIVERS = libretro
293 ifeq ($(platform),ios)
294 ifeq ($(USE_DYNAREC),1)
295 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) clean
296 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform)
302 # no special AS needed for gpu_neon
303 plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
304 $(CC) $(CFLAGS) -c $^ -o $@