1 # Makefile for PCSX ReARMed (libretro)
5 ifeq ($(shell uname -a),)
7 else ifneq ($(findstring MINGW,$(shell uname -a)),)
9 else ifneq ($(findstring Darwin,$(shell uname -a)),)
11 else ifneq ($(findstring win,$(shell uname -a)),)
22 TARGET_NAME := pcsx_rearmed
25 LIBPTHREAD := -lpthread
31 ifeq ($(platform), unix)
32 TARGET := $(TARGET_NAME)_libretro.so
34 SHARED := -shared -Wl,--version-script=libretro/link.T
36 else ifeq ($(platform), linux-portable)
37 TARGET := $(TARGET_NAME)_libretro.so
38 fpic := -fPIC -nostdlib
39 EXTRA_LDFLAGS += -fPIC -nostdlib
44 SHARED := -shared -Wl,--version-script=libretro/link.T
46 else ifeq ($(platform), osx)
47 TARGET := $(TARGET_NAME)_libretro.dylib
50 OSXVER = `sw_vers -productVersion | cut -d. -f 2`
51 OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"`
52 fpic += -mmacosx-version-min=10.1
55 else ifneq (,$(findstring ios,$(platform)))
58 TARGET := $(TARGET_NAME)_libretro_ios.dylib
59 ifeq ($(USE_DYNAREC),0)
61 TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib
67 IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
70 CC = clang -arch armv7 -isysroot $(IOSSDK)
71 CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
72 CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
73 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
74 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
78 ifeq ($(platform),ios9)
79 CC += -miphoneos-version-min=8.0
80 CXX += -miphoneos-version-min=8.0
81 CC_AS += -miphoneos-version-min=8.0
82 CFLAGS += -miphoneos-version-min=8.0
84 CC += -miphoneos-version-min=5.0
85 CXX += -miphoneos-version-min=5.0
86 CC_AS += -miphoneos-version-min=5.0
87 CFLAGS += -miphoneos-version-min=5.0
91 else ifeq ($(platform), ps3)
92 TARGET := $(TARGET_NAME)_libretro_ps3.a
93 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
94 AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
95 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
98 else ifeq ($(platform), sncps3)
99 TARGET := $(TARGET_NAME)_libretro_ps3.a
100 CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
101 AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
102 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
104 # Lightweight PS3 Homebrew SDK
105 else ifeq ($(platform), psl1ght)
106 TARGET := $(TARGET_NAME)_libretro_psl1ght.a
107 CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
108 AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
109 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
112 else ifeq ($(platform), psp1)
113 TARGET := $(TARGET_NAME)_libretro_psp1.a
114 CC = psp-gcc$(EXE_EXT)
115 AR = psp-ar$(EXE_EXT)
119 else ifeq ($(platform), vita)
120 TARGET := $(TARGET_NAME)_libretro_vita.a
121 CC = arm-vita-eabi-gcc$(EXE_EXT)
122 AR = arm-vita-eabi-ar$(EXE_EXT)
124 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm
125 CFLAGS += -I$(VITASDK)/include -Ifrontend/vita
126 CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB
127 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
129 # CFLAGS += -U__ARM_NEON__
140 else ifeq ($(platform), ctr)
141 TARGET := $(TARGET_NAME)_libretro_ctr.a
142 CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT)
143 CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT)
144 AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT)
145 CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET
146 CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft
147 CFLAGS += -Wall -mword-relocations
148 CFLAGS += -fomit-frame-pointer -ffast-math
149 CFLAGS += -Ifrontend/3ds
150 CFLAGS += -Werror=implicit-function-declaration
161 else ifeq ($(platform), xenon)
162 TARGET := $(TARGET_NAME)_libretro_xenon360.a
163 CC = xenon-gcc$(EXE_EXT)
164 AR = xenon-ar$(EXE_EXT)
165 CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
168 else ifeq ($(platform), ngc)
169 TARGET := $(TARGET_NAME)_libretro_ngc.a
170 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
171 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
172 CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
175 else ifeq ($(platform), wii)
176 TARGET := libretro_$(TARGET_NAME)_wii.a
177 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
178 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
179 CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
182 else ifeq ($(platform), qnx)
183 TARGET := $(TARGET_NAME)_libretro_qnx.so
185 CC = qcc -Vgcc_ntoarmv7le
192 CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp
193 ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp
196 else ifneq (,$(findstring armv,$(platform)))
197 TARGET := $(TARGET_NAME)_libretro.so
198 SHARED := -shared -Wl,--no-undefined
201 ifneq (,$(findstring cortexa8,$(platform)))
202 CFLAGS += -marm -mcpu=cortex-a8
203 ASFLAGS += -mcpu=cortex-a8
204 else ifneq (,$(findstring cortexa9,$(platform)))
205 CFLAGS += -marm -mcpu=cortex-a9
206 ASFLAGS += -mcpu=cortex-a9
209 ifneq (,$(findstring neon,$(platform)))
211 ASFLAGS += -mfpu=neon
215 ifneq (,$(findstring softfloat,$(platform)))
216 CFLAGS += -mfloat-abi=softfp
217 ASFLAGS += -mfloat-abi=softfp
218 else ifneq (,$(findstring hardfloat,$(platform)))
219 CFLAGS += -mfloat-abi=hard
220 ASFLAGS += -mfloat-abi=hard
227 TARGET := $(TARGET_NAME)_libretro.dll
231 SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T
232 CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__
237 ifeq ($(platform),win)
238 MAIN_LDLIBS += -lws2_32
239 else ifneq ($(platform),qnx)
240 LDLIBS += $(LIBPHTREAD)
241 MAIN_LDLIBS += $(LIBDL)
243 MAIN_LDFLAGS += -shared
244 MAIN_LDLIBS += $(LIBM) $(LIBZ)
246 TARGET ?= libretro.so
249 SOUND_DRIVERS = libretro
254 ifeq ($(platform),ios)
255 ifeq ($(USE_DYNAREC),1)
256 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) clean
257 make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform)
263 # no special AS needed for gpu_neon
264 plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S
265 $(CC) $(CFLAGS) -c $^ -o $@