| 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 | |
| 24 | MMAP_WIN32=0 |
| 25 | |
| 26 | # Unix |
| 27 | ifeq ($(platform), unix) |
| 28 | TARGET := $(TARGET_NAME)_libretro.so |
| 29 | fpic := -fPIC |
| 30 | SHARED := -shared -Wl,--version-script=libretro/link.T |
| 31 | |
| 32 | # OS X |
| 33 | else ifeq ($(platform), osx) |
| 34 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 35 | fpic := -fPIC |
| 36 | SHARED := -dynamiclib |
| 37 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 38 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 39 | ifeq ($(OSX_LT_MAVERICKS),"YES") |
| 40 | fpic += -mmacosx-version-min=10.5 |
| 41 | endif |
| 42 | |
| 43 | # iOS |
| 44 | else ifeq ($(platform), ios) |
| 45 | ARCH := arm |
| 46 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 47 | fpic := -fPIC |
| 48 | SHARED := -dynamiclib |
| 49 | |
| 50 | ifeq ($(IOSSDK),) |
| 51 | IOSSDK := $(shell xcrun -sdk iphoneos -show-sdk-path) |
| 52 | endif |
| 53 | |
| 54 | CC = clang -arch armv7 -isysroot $(IOSSDK) |
| 55 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) |
| 56 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) |
| 57 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 58 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 59 | HAVE_NEON = 1 |
| 60 | BUILTIN_GPU = neon |
| 61 | USE_DYNAREC = 1 |
| 62 | CFLAGS += -DIOS |
| 63 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 64 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 65 | ifeq ($(OSX_LT_MAVERICKS),"YES") |
| 66 | CC += -miphoneos-version-min=5.0 |
| 67 | CXX += -miphoneos-version-min=5.0 |
| 68 | CC_AS += -miphoneos-version-min=5.0 |
| 69 | CFLAGS += -miphoneos-version-min=5.0 |
| 70 | endif |
| 71 | |
| 72 | # PS3 |
| 73 | else ifeq ($(platform), ps3) |
| 74 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 75 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe |
| 76 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe |
| 77 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 78 | |
| 79 | # sncps3 |
| 80 | else ifeq ($(platform), sncps3) |
| 81 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 82 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe |
| 83 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe |
| 84 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 85 | |
| 86 | # Lightweight PS3 Homebrew SDK |
| 87 | else ifeq ($(platform), psl1ght) |
| 88 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 89 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 90 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 91 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 92 | |
| 93 | # PSP |
| 94 | else ifeq ($(platform), psp1) |
| 95 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 96 | CC = psp-gcc$(EXE_EXT) |
| 97 | AR = psp-ar$(EXE_EXT) |
| 98 | CFLAGS += -DPSP -G0 |
| 99 | |
| 100 | # Xbox 360 |
| 101 | else ifeq ($(platform), xenon) |
| 102 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
| 103 | CC = xenon-gcc$(EXE_EXT) |
| 104 | AR = xenon-ar$(EXE_EXT) |
| 105 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ |
| 106 | |
| 107 | # Nintendo Game Cube |
| 108 | else ifeq ($(platform), ngc) |
| 109 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
| 110 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 111 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 112 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 113 | |
| 114 | # Nintendo Wii |
| 115 | else ifeq ($(platform), wii) |
| 116 | TARGET := libretro_$(TARGET_NAME)_wii.a |
| 117 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 118 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 119 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 120 | |
| 121 | # QNX |
| 122 | else ifeq ($(platform), qnx) |
| 123 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 124 | CC = qcc -Vgcc_ntoarmv7le |
| 125 | CC_AS = $(CC) |
| 126 | HAVE_NEON = 1 |
| 127 | USE_DYNAREC = 1 |
| 128 | DRC_CACHE_BASE = 0 |
| 129 | BUILTIN_GPU = neon |
| 130 | ARCH = arm |
| 131 | CFLAGS += -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 132 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 133 | |
| 134 | # ARM |
| 135 | else ifneq (,$(findstring armv,$(platform))) |
| 136 | TARGET := $(TARGET_NAME)_libretro.so |
| 137 | SHARED := -shared -Wl,--no-undefined |
| 138 | DRC_CACHE_BASE = 0 |
| 139 | ifneq (,$(findstring cortexa8,$(platform))) |
| 140 | CFLAGS += -marm -mcpu=cortex-a8 |
| 141 | ASFLAGS += -mcpu=cortex-a8 |
| 142 | else ifneq (,$(findstring cortexa9,$(platform))) |
| 143 | CFLAGS += -marm -mcpu=cortex-a9 |
| 144 | ASFLAGS += -mcpu=cortex-a9 |
| 145 | endif |
| 146 | CFLAGS += -marm |
| 147 | ifneq (,$(findstring neon,$(platform))) |
| 148 | CFLAGS += -mfpu=neon |
| 149 | ASFLAGS += -mfpu=neon |
| 150 | HAVE_NEON = 1 |
| 151 | BUILTIN_GPU = neon |
| 152 | endif |
| 153 | ifneq (,$(findstring softfloat,$(platform))) |
| 154 | CFLAGS += -mfloat-abi=softfp |
| 155 | ASFLAGS += -mfloat-abi=softfp |
| 156 | else ifneq (,$(findstring hardfloat,$(platform))) |
| 157 | CFLAGS += -mfloat-abi=hard |
| 158 | ASFLAGS += -mfloat-abi=hard |
| 159 | endif |
| 160 | ARCH = arm |
| 161 | USE_DYNAREC = 1 |
| 162 | |
| 163 | # Windows |
| 164 | else |
| 165 | TARGET := $(TARGET_NAME)_libretro.dll |
| 166 | CC = gcc |
| 167 | fpic := -fPIC |
| 168 | LD_FLAGS := -fPIC |
| 169 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T |
| 170 | CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ |
| 171 | MMAP_WIN32=1 |
| 172 | endif |
| 173 | |
| 174 | CFLAGS += -fPIC |
| 175 | ifeq ($(platform),win) |
| 176 | MAIN_LDLIBS += -lws2_32 |
| 177 | else ifneq ($(platform),qnx) |
| 178 | LDLIBS += -lpthread |
| 179 | MAIN_LDLIBS += -ldl |
| 180 | endif |
| 181 | MAIN_LDFLAGS += -shared |
| 182 | MAIN_LDLIBS += -lm -lz |
| 183 | EXTRA_LDFLAGS = |
| 184 | |
| 185 | # try to autodetect stuff for the lazy |
| 186 | ifndef ARCH |
| 187 | ARCH = $(shell $(CC) -dumpmachine | awk -F- '{print $$1}') |
| 188 | endif |
| 189 | ifndef HAVE_NEON |
| 190 | HAVE_NEON = $(shell $(CC) -E -dD - < /dev/null 2> /dev/null | grep -q __ARM_NEON__ && echo 1 || echo 0) |
| 191 | endif |
| 192 | ifeq ($(shell ld -v 2> /dev/null | awk '{print $$1}'),GNU) |
| 193 | MAIN_LDFLAGS += -Wl,--no-undefined |
| 194 | endif |
| 195 | |
| 196 | TARGET ?= libretro.so |
| 197 | PLATFORM = libretro |
| 198 | BUILTIN_GPU ?= peops |
| 199 | SOUND_DRIVERS = libretro |
| 200 | PLUGINS = |
| 201 | NO_CONFIG_MAK = yes |
| 202 | |
| 203 | include Makefile |
| 204 | |
| 205 | # no special AS needed for gpu_neon |
| 206 | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S |
| 207 | $(CC) $(CFLAGS) -c $^ -o $@ |