| 1 | # Makefile for PCSX ReARMed (libretro) |
| 2 | |
| 3 | DEBUG=0 |
| 4 | |
| 5 | ifeq ($(platform),) |
| 6 | platform = unix |
| 7 | ifeq ($(shell uname -a),) |
| 8 | platform = win |
| 9 | else ifneq ($(findstring MINGW,$(shell uname -a)),) |
| 10 | platform = win |
| 11 | else ifneq ($(findstring Darwin,$(shell uname -a)),) |
| 12 | platform = osx |
| 13 | else ifneq ($(findstring win,$(shell uname -a)),) |
| 14 | platform = win |
| 15 | endif |
| 16 | endif |
| 17 | |
| 18 | CC ?= gcc |
| 19 | CXX ?= g++ |
| 20 | AS ?= as |
| 21 | CC_AS ?= $(CC) |
| 22 | CFLAGS ?= |
| 23 | |
| 24 | TARGET_NAME := pcsx_rearmed |
| 25 | LIBZ := -lz |
| 26 | LIBPTHREAD := -lpthread |
| 27 | MMAP_WIN32=0 |
| 28 | EXTRA_LDFLAGS = |
| 29 | |
| 30 | # Unix |
| 31 | ifeq ($(platform), unix) |
| 32 | TARGET := $(TARGET_NAME)_libretro.so |
| 33 | fpic := -fPIC |
| 34 | |
| 35 | else ifeq ($(platform), linux-portable) |
| 36 | TARGET := $(TARGET_NAME)_libretro.so |
| 37 | fpic := -fPIC -nostdlib |
| 38 | EXTRA_LDFLAGS += -fPIC -nostdlib |
| 39 | LIBZ := |
| 40 | LIBPTHREAD := |
| 41 | LIBDL := |
| 42 | NO_UNDEF_CHECK = 1 |
| 43 | |
| 44 | # OS X |
| 45 | else ifeq ($(platform), osx) |
| 46 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 47 | fpic := -fPIC |
| 48 | fpic += -mmacosx-version-min=10.1 |
| 49 | |
| 50 | # iOS |
| 51 | else ifneq (,$(findstring ios,$(platform))) |
| 52 | ARCH := arm |
| 53 | USE_DYNAREC ?= 1 |
| 54 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 55 | ifeq ($(USE_DYNAREC),0) |
| 56 | # Override |
| 57 | TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib |
| 58 | endif |
| 59 | fpic := -fPIC |
| 60 | |
| 61 | ifeq ($(IOSSDK),) |
| 62 | IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) |
| 63 | endif |
| 64 | |
| 65 | CC = clang -arch armv7 -isysroot $(IOSSDK) |
| 66 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) |
| 67 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) |
| 68 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 69 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 70 | HAVE_NEON = 1 |
| 71 | BUILTIN_GPU = neon |
| 72 | CFLAGS += -DIOS |
| 73 | ifeq ($(platform),ios9) |
| 74 | CC += -miphoneos-version-min=8.0 |
| 75 | CXX += -miphoneos-version-min=8.0 |
| 76 | CC_AS += -miphoneos-version-min=8.0 |
| 77 | CFLAGS += -miphoneos-version-min=8.0 |
| 78 | else |
| 79 | CC += -miphoneos-version-min=5.0 |
| 80 | CXX += -miphoneos-version-min=5.0 |
| 81 | CC_AS += -miphoneos-version-min=5.0 |
| 82 | CFLAGS += -miphoneos-version-min=5.0 |
| 83 | endif |
| 84 | |
| 85 | # PS3 |
| 86 | else ifeq ($(platform), ps3) |
| 87 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 88 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe |
| 89 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe |
| 90 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 91 | |
| 92 | # sncps3 |
| 93 | else ifeq ($(platform), sncps3) |
| 94 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 95 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe |
| 96 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe |
| 97 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 98 | |
| 99 | # Lightweight PS3 Homebrew SDK |
| 100 | else ifeq ($(platform), psl1ght) |
| 101 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 102 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 103 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 104 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 105 | |
| 106 | # PSP |
| 107 | else ifeq ($(platform), psp1) |
| 108 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 109 | CC = psp-gcc$(EXE_EXT) |
| 110 | AR = psp-ar$(EXE_EXT) |
| 111 | CFLAGS += -DPSP -G0 |
| 112 | |
| 113 | # Vita |
| 114 | else ifeq ($(platform), vita) |
| 115 | TARGET := $(TARGET_NAME)_libretro_vita.a |
| 116 | CC = arm-vita-eabi-gcc$(EXE_EXT) |
| 117 | AR = arm-vita-eabi-ar$(EXE_EXT) |
| 118 | CFLAGS += -DVITA |
| 119 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 120 | CFLAGS += -I$(VITASDK)/include -Ifrontend/vita |
| 121 | CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB |
| 122 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 123 | |
| 124 | # CFLAGS += -U__ARM_NEON__ |
| 125 | HAVE_NEON = 1 |
| 126 | BUILTIN_GPU = neon |
| 127 | |
| 128 | USE_DYNAREC = 1 |
| 129 | DRC_CACHE_BASE = 0 |
| 130 | |
| 131 | ARCH = arm |
| 132 | STATIC_LINKING = 1 |
| 133 | |
| 134 | # CTR(3DS) |
| 135 | else ifeq ($(platform), ctr) |
| 136 | TARGET := $(TARGET_NAME)_libretro_ctr.a |
| 137 | CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT) |
| 138 | CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) |
| 139 | AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) |
| 140 | CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB -DNO_SOCKET |
| 141 | CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp -mtp=soft |
| 142 | CFLAGS += -Wall -mword-relocations |
| 143 | CFLAGS += -fomit-frame-pointer -ffast-math |
| 144 | CFLAGS += -Ifrontend/3ds |
| 145 | CFLAGS += -Werror=implicit-function-declaration |
| 146 | |
| 147 | # CFLAGS += -DPCSX |
| 148 | # BUILTIN_GPU = unai |
| 149 | USE_DYNAREC = 1 |
| 150 | DRC_CACHE_BASE = 1 |
| 151 | ARCH = arm |
| 152 | |
| 153 | STATIC_LINKING = 1 |
| 154 | |
| 155 | # Xbox 360 |
| 156 | else ifeq ($(platform), xenon) |
| 157 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
| 158 | CC = xenon-gcc$(EXE_EXT) |
| 159 | AR = xenon-ar$(EXE_EXT) |
| 160 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ |
| 161 | |
| 162 | # Nintendo Game Cube |
| 163 | else ifeq ($(platform), ngc) |
| 164 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
| 165 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 166 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 167 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 168 | |
| 169 | # Nintendo Wii |
| 170 | else ifeq ($(platform), wii) |
| 171 | TARGET := libretro_$(TARGET_NAME)_wii.a |
| 172 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 173 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 174 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 175 | |
| 176 | # QNX |
| 177 | else ifeq ($(platform), qnx) |
| 178 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 179 | fpic := -fPIC |
| 180 | CC = qcc -Vgcc_ntoarmv7le |
| 181 | CC_AS = $(CC) |
| 182 | HAVE_NEON = 1 |
| 183 | USE_DYNAREC = 1 |
| 184 | DRC_CACHE_BASE = 0 |
| 185 | BUILTIN_GPU = neon |
| 186 | ARCH = arm |
| 187 | CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 188 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 189 | MAIN_LDLIBS += -lsocket |
| 190 | LIBPTHREAD := |
| 191 | LIBDL := |
| 192 | |
| 193 | #Raspberry Pi 2 |
| 194 | else ifeq ($(platform), rpi2) |
| 195 | TARGET := $(TARGET_NAME)_libretro.so |
| 196 | fpic := -fPIC |
| 197 | CFLAGS += -marm -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
| 198 | ASFLAGS += -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard |
| 199 | HAVE_NEON = 1 |
| 200 | ARCH = arm |
| 201 | BUILTIN_GPU = neon |
| 202 | USE_DYNAREC = 1 |
| 203 | |
| 204 | #Raspberry Pi 3 |
| 205 | else ifeq ($(platform), rpi3) |
| 206 | TARGET := $(TARGET_NAME)_libretro.so |
| 207 | fpic := -fPIC |
| 208 | CFLAGS += -marm -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 209 | ASFLAGS += -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -mfloat-abi=hard |
| 210 | HAVE_NEON = 1 |
| 211 | ARCH = arm |
| 212 | BUILTIN_GPU = neon |
| 213 | USE_DYNAREC = 1 |
| 214 | |
| 215 | # ARM |
| 216 | else ifneq (,$(findstring armv,$(platform))) |
| 217 | TARGET := $(TARGET_NAME)_libretro.so |
| 218 | fpic := -fPIC |
| 219 | DRC_CACHE_BASE = 0 |
| 220 | ifneq (,$(findstring cortexa8,$(platform))) |
| 221 | CFLAGS += -marm -mcpu=cortex-a8 |
| 222 | ASFLAGS += -mcpu=cortex-a8 |
| 223 | else ifneq (,$(findstring cortexa9,$(platform))) |
| 224 | CFLAGS += -marm -mcpu=cortex-a9 |
| 225 | ASFLAGS += -mcpu=cortex-a9 |
| 226 | endif |
| 227 | CFLAGS += -marm |
| 228 | ifneq (,$(findstring neon,$(platform))) |
| 229 | CFLAGS += -mfpu=neon |
| 230 | ASFLAGS += -mfpu=neon |
| 231 | HAVE_NEON = 1 |
| 232 | BUILTIN_GPU = neon |
| 233 | endif |
| 234 | ifneq (,$(findstring softfloat,$(platform))) |
| 235 | CFLAGS += -mfloat-abi=softfp |
| 236 | ASFLAGS += -mfloat-abi=softfp |
| 237 | else ifneq (,$(findstring hardfloat,$(platform))) |
| 238 | CFLAGS += -mfloat-abi=hard |
| 239 | ASFLAGS += -mfloat-abi=hard |
| 240 | endif |
| 241 | ARCH = arm |
| 242 | USE_DYNAREC = 1 |
| 243 | |
| 244 | # Windows |
| 245 | else |
| 246 | TARGET := $(TARGET_NAME)_libretro.dll |
| 247 | MAIN_LDFLAGS += -static-libgcc -static-libstdc++ -s |
| 248 | CFLAGS += -D__WIN32__ |
| 249 | MMAP_WIN32=1 |
| 250 | MAIN_LDLIBS += -lws2_32 |
| 251 | LIBPTHREAD := |
| 252 | LIBDL := |
| 253 | endif |
| 254 | |
| 255 | CFLAGS += $(fpic) |
| 256 | MAIN_LDFLAGS += -shared |
| 257 | MAIN_LDLIBS += $(LIBPTHREAD) $(LIBDL) $(LIBZ) |
| 258 | |
| 259 | # try to autodetect stuff for the lazy |
| 260 | ifndef ARCH |
| 261 | ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}') |
| 262 | endif |
| 263 | ifndef HAVE_NEON |
| 264 | HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0) |
| 265 | endif |
| 266 | ifeq ($(NO_UNDEF_CHECK)$(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) |
| 267 | MAIN_LDFLAGS += -Wl,--no-undefined |
| 268 | endif |
| 269 | |
| 270 | TARGET ?= libretro.so |
| 271 | PLATFORM = libretro |
| 272 | BUILTIN_GPU ?= peops |
| 273 | SOUND_DRIVERS = libretro |
| 274 | PLUGINS = |
| 275 | NO_CONFIG_MAK = yes |
| 276 | |
| 277 | libretro_all: all |
| 278 | ifeq ($(platform),ios) |
| 279 | ifeq ($(USE_DYNAREC),1) |
| 280 | make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) clean |
| 281 | make -f Makefile.libretro USE_DYNAREC=0 platform=$(platform) |
| 282 | endif |
| 283 | endif |
| 284 | |
| 285 | include Makefile |
| 286 | |
| 287 | # no special AS needed for gpu_neon |
| 288 | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S |
| 289 | $(CC) $(CFLAGS) -c $^ -o $@ |