| 1 | # Makefile for PCSX ReARMed (libretro) |
| 2 | |
| 3 | ifeq ($(platform),) |
| 4 | platform = unix |
| 5 | ifeq ($(shell uname -a),) |
| 6 | platform = win |
| 7 | else ifneq ($(findstring MINGW,$(shell uname -a)),) |
| 8 | platform = win |
| 9 | else ifneq ($(findstring Darwin,$(shell uname -a)),) |
| 10 | platform = osx |
| 11 | else ifneq ($(findstring win,$(shell uname -a)),) |
| 12 | platform = win |
| 13 | endif |
| 14 | endif |
| 15 | |
| 16 | CC ?= gcc |
| 17 | CXX ?= g++ |
| 18 | AS ?= as |
| 19 | CC_AS ?= $(CC) |
| 20 | CFLAGS ?= |
| 21 | |
| 22 | TARGET_NAME := pcsx_rearmed |
| 23 | LIBM := -lm |
| 24 | LIBZ := -lz |
| 25 | LIBPTHREAD := -lpthread |
| 26 | LIBDL := -ldl |
| 27 | MMAP_WIN32=0 |
| 28 | EXTRA_LDFLAGS = |
| 29 | |
| 30 | # Unix |
| 31 | ifeq ($(platform), unix) |
| 32 | TARGET := $(TARGET_NAME)_libretro.so |
| 33 | fpic := -fPIC |
| 34 | SHARED := -shared -Wl,--version-script=libretro/link.T |
| 35 | |
| 36 | else ifeq ($(platform), linux-portable) |
| 37 | TARGET := $(TARGET_NAME)_libretro.so |
| 38 | fpic := -fPIC -nostdlib |
| 39 | EXTRA_LDFLAGS += -fPIC -nostdlib |
| 40 | LIBM := |
| 41 | LIBZ := |
| 42 | LIBPTHREAD := |
| 43 | LIBDL := |
| 44 | SHARED := -shared -Wl,--version-script=libretro/link.T |
| 45 | # OS X |
| 46 | else ifeq ($(platform), osx) |
| 47 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 48 | fpic := -fPIC |
| 49 | SHARED := -dynamiclib |
| 50 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 51 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 52 | fpic += -mmacosx-version-min=10.1 |
| 53 | |
| 54 | # iOS |
| 55 | else ifeq ($(platform), ios) |
| 56 | ARCH := arm |
| 57 | USE_DYNAREC ?= 1 |
| 58 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 59 | ifeq ($(USE_DYNAREC),0) |
| 60 | # Override |
| 61 | TARGET := $(TARGET_NAME)_interpreter_libretro_ios.dylib |
| 62 | endif |
| 63 | fpic := -fPIC |
| 64 | SHARED := -dynamiclib |
| 65 | |
| 66 | ifeq ($(IOSSDK),) |
| 67 | IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path) |
| 68 | endif |
| 69 | |
| 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 |
| 75 | HAVE_NEON = 1 |
| 76 | BUILTIN_GPU = neon |
| 77 | CFLAGS += -DIOS |
| 78 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 79 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 80 | ifeq ($(OSX_LT_MAVERICKS),"YES") |
| 81 | CC += -miphoneos-version-min=5.0 |
| 82 | CXX += -miphoneos-version-min=5.0 |
| 83 | CC_AS += -miphoneos-version-min=5.0 |
| 84 | CFLAGS += -miphoneos-version-min=5.0 |
| 85 | endif |
| 86 | |
| 87 | # PS3 |
| 88 | else ifeq ($(platform), ps3) |
| 89 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 90 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe |
| 91 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe |
| 92 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 93 | |
| 94 | # sncps3 |
| 95 | else ifeq ($(platform), sncps3) |
| 96 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 97 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe |
| 98 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe |
| 99 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 100 | |
| 101 | # Lightweight PS3 Homebrew SDK |
| 102 | else ifeq ($(platform), psl1ght) |
| 103 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 104 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 105 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 106 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 107 | |
| 108 | # PSP |
| 109 | else ifeq ($(platform), psp1) |
| 110 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 111 | CC = psp-gcc$(EXE_EXT) |
| 112 | AR = psp-ar$(EXE_EXT) |
| 113 | CFLAGS += -DPSP -G0 |
| 114 | |
| 115 | # Vita |
| 116 | else ifeq ($(platform), vita) |
| 117 | TARGET := $(TARGET_NAME)_libretro_vita.a |
| 118 | CC = arm-vita-eabi-gcc$(EXE_EXT) |
| 119 | AR = arm-vita-eabi-ar$(EXE_EXT) |
| 120 | CFLAGS += -DVITA |
| 121 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 122 | CFLAGS += -I$(VITASDK)/include -Ifrontend/vita |
| 123 | CFLAGS += -DNO_SOCKET -DNO_OS -DNO_DYLIB |
| 124 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 125 | |
| 126 | # CFLAGS += -U__ARM_NEON__ |
| 127 | HAVE_NEON = 1 |
| 128 | BUILTIN_GPU = neon |
| 129 | |
| 130 | # USE_DYNAREC = 1 |
| 131 | # DRC_CACHE_BASE = 0 |
| 132 | |
| 133 | ARCH = arm |
| 134 | STATIC_LINKING = 1 |
| 135 | |
| 136 | # CTR(3DS) |
| 137 | else ifeq ($(platform), ctr) |
| 138 | TARGET := $(TARGET_NAME)_libretro_ctr.a |
| 139 | CC = $(DEVKITARM)/bin/arm-none-eabi-gcc$(EXE_EXT) |
| 140 | CXX = $(DEVKITARM)/bin/arm-none-eabi-g++$(EXE_EXT) |
| 141 | AR = $(DEVKITARM)/bin/arm-none-eabi-ar$(EXE_EXT) |
| 142 | CFLAGS += -DARM11 -D_3DS -DNO_OS -DNO_DYLIB |
| 143 | CFLAGS += -march=armv6k -mtune=mpcore -mfloat-abi=hard -marm -mfpu=vfp |
| 144 | CFLAGS += -Wall -mword-relocations |
| 145 | CFLAGS += -fomit-frame-pointer -ffast-math |
| 146 | CFLAGS += -I$(CTRULIB)/include -I$(DEVKITPRO)/portlibs/armv6k/include -Ifrontend/3ds |
| 147 | CFLAGS += -Werror=implicit-function-declaration |
| 148 | |
| 149 | OBJS += frontend/3ds/3ds_utils.o |
| 150 | |
| 151 | |
| 152 | # CFLAGS += -DPCSX |
| 153 | # BUILTIN_GPU = unai |
| 154 | USE_DYNAREC = 1 |
| 155 | DRC_CACHE_BASE = 0 |
| 156 | ARCH = arm |
| 157 | |
| 158 | STATIC_LINKING = 1 |
| 159 | |
| 160 | # Xbox 360 |
| 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__ |
| 166 | |
| 167 | # Nintendo Game Cube |
| 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__ |
| 173 | |
| 174 | # Nintendo Wii |
| 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__ |
| 180 | |
| 181 | # QNX |
| 182 | else ifeq ($(platform), qnx) |
| 183 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 184 | fpic := -fPIC |
| 185 | CC = qcc -Vgcc_ntoarmv7le |
| 186 | CC_AS = $(CC) |
| 187 | HAVE_NEON = 1 |
| 188 | USE_DYNAREC = 1 |
| 189 | DRC_CACHE_BASE = 0 |
| 190 | BUILTIN_GPU = neon |
| 191 | ARCH = arm |
| 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 |
| 194 | |
| 195 | # ARM |
| 196 | else ifneq (,$(findstring armv,$(platform))) |
| 197 | TARGET := $(TARGET_NAME)_libretro.so |
| 198 | SHARED := -shared -Wl,--no-undefined |
| 199 | fpic := -fPIC |
| 200 | DRC_CACHE_BASE = 0 |
| 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 |
| 207 | endif |
| 208 | CFLAGS += -marm |
| 209 | ifneq (,$(findstring neon,$(platform))) |
| 210 | CFLAGS += -mfpu=neon |
| 211 | ASFLAGS += -mfpu=neon |
| 212 | HAVE_NEON = 1 |
| 213 | BUILTIN_GPU = neon |
| 214 | endif |
| 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 |
| 221 | endif |
| 222 | ARCH = arm |
| 223 | USE_DYNAREC = 1 |
| 224 | |
| 225 | # Windows |
| 226 | else |
| 227 | TARGET := $(TARGET_NAME)_libretro.dll |
| 228 | CC = gcc |
| 229 | fpic := -fPIC |
| 230 | LD_FLAGS := -fPIC |
| 231 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T |
| 232 | CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ |
| 233 | MMAP_WIN32=1 |
| 234 | endif |
| 235 | |
| 236 | CFLAGS += $(fpic) |
| 237 | ifeq ($(platform),win) |
| 238 | MAIN_LDLIBS += -lws2_32 |
| 239 | else ifneq ($(platform),qnx) |
| 240 | LDLIBS += $(LIBPHTREAD) |
| 241 | MAIN_LDLIBS += $(LIBDL) |
| 242 | endif |
| 243 | MAIN_LDFLAGS += -shared |
| 244 | MAIN_LDLIBS += $(LIBM) $(LIBZ) |
| 245 | |
| 246 | TARGET ?= libretro.so |
| 247 | PLATFORM = libretro |
| 248 | BUILTIN_GPU ?= peops |
| 249 | SOUND_DRIVERS = libretro |
| 250 | PLUGINS = |
| 251 | NO_CONFIG_MAK = yes |
| 252 | |
| 253 | libretro_all: all |
| 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) |
| 258 | endif |
| 259 | endif |
| 260 | |
| 261 | include Makefile |
| 262 | |
| 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 $@ |