| 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 | ifeq ($(platform), unix) |
| 25 | TARGET := $(TARGET_NAME)_libretro.so |
| 26 | fpic := -fPIC |
| 27 | SHARED := -shared -Wl,--version-script=libretro/link.T |
| 28 | else ifeq ($(platform), osx) |
| 29 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 30 | fpic := -fPIC |
| 31 | SHARED := -dynamiclib |
| 32 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 33 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 34 | ifeq ($(OSX_LT_MAVERICKS),"YES") |
| 35 | fpic += -mmacosx-version-min=10.5 |
| 36 | endif |
| 37 | else ifeq ($(platform), ios) |
| 38 | ARCH := arm |
| 39 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 40 | fpic := -fPIC |
| 41 | SHARED := -dynamiclib |
| 42 | |
| 43 | ifeq ($(IOSSDK),) |
| 44 | IOSSDK := $(shell xcrun -sdk iphoneos -show-sdk-path) |
| 45 | endif |
| 46 | |
| 47 | CC = clang -arch armv7 -isysroot $(IOSSDK) |
| 48 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) |
| 49 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) |
| 50 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 51 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 52 | HAVE_NEON = 1 |
| 53 | BUILTIN_GPU = neon |
| 54 | USE_DYNAREC = 1 |
| 55 | CFLAGS += -DIOS |
| 56 | OSXVER = `sw_vers -productVersion | cut -d. -f 2` |
| 57 | OSX_LT_MAVERICKS = `(( $(OSXVER) <= 9)) && echo "YES"` |
| 58 | ifeq ($(OSX_LT_MAVERICKS),"YES") |
| 59 | CC += -miphoneos-version-min=5.0 |
| 60 | CXX += -miphoneos-version-min=5.0 |
| 61 | CC_AS += -miphoneos-version-min=5.0 |
| 62 | CFLAGS += -miphoneos-version-min=5.0 |
| 63 | endif |
| 64 | else ifeq ($(platform), ps3) |
| 65 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 66 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe |
| 67 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe |
| 68 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 69 | else ifeq ($(platform), sncps3) |
| 70 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 71 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe |
| 72 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe |
| 73 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 74 | else ifeq ($(platform), psl1ght) |
| 75 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 76 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 77 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 78 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 79 | else ifeq ($(platform), psp1) |
| 80 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 81 | CC = psp-gcc$(EXE_EXT) |
| 82 | AR = psp-ar$(EXE_EXT) |
| 83 | CFLAGS += -DPSP -G0 |
| 84 | else ifeq ($(platform), xenon) |
| 85 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
| 86 | CC = xenon-gcc$(EXE_EXT) |
| 87 | AR = xenon-ar$(EXE_EXT) |
| 88 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ |
| 89 | else ifeq ($(platform), ngc) |
| 90 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
| 91 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 92 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 93 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 94 | else ifeq ($(platform), wii) |
| 95 | TARGET := libretro_$(TARGET_NAME)_wii.a |
| 96 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 97 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 98 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 99 | else ifeq ($(platform), qnx) |
| 100 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 101 | CC = qcc -Vgcc_ntoarmv7le |
| 102 | CC_AS = $(CC) |
| 103 | HAVE_NEON = 1 |
| 104 | USE_DYNAREC = 1 |
| 105 | DRC_CACHE_BASE = 0 |
| 106 | BUILTIN_GPU = neon |
| 107 | ARCH = arm |
| 108 | CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 109 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 110 | else ifneq (,$(findstring armv,$(platform))) |
| 111 | TARGET := $(TARGET_NAME)_libretro.so |
| 112 | SHARED := -shared -Wl,--no-undefined |
| 113 | DRC_CACHE_BASE = 0 |
| 114 | ifneq (,$(findstring cortexa8,$(platform))) |
| 115 | CFLAGS += -marm -mcpu=cortex-a8 |
| 116 | ASFLAGS += -mcpu=cortex-a8 |
| 117 | else ifneq (,$(findstring cortexa9,$(platform))) |
| 118 | CFLAGS += -marm -mcpu=cortex-a9 |
| 119 | ASFLAGS += -mcpu=cortex-a9 |
| 120 | endif |
| 121 | CFLAGS += -marm |
| 122 | ifneq (,$(findstring neon,$(platform))) |
| 123 | CFLAGS += -mfpu=neon |
| 124 | ASFLAGS += -mfpu=neon |
| 125 | HAVE_NEON = 1 |
| 126 | BUILTIN_GPU = neon |
| 127 | endif |
| 128 | ifneq (,$(findstring softfloat,$(platform))) |
| 129 | CFLAGS += -mfloat-abi=softfp |
| 130 | ASFLAGS += -mfloat-abi=softfp |
| 131 | else ifneq (,$(findstring hardfloat,$(platform))) |
| 132 | CFLAGS += -mfloat-abi=hard |
| 133 | ASFLAGS += -mfloat-abi=hard |
| 134 | endif |
| 135 | ARCH = arm |
| 136 | USE_DYNAREC = 1 |
| 137 | else |
| 138 | TARGET := $(TARGET_NAME)_libretro.dll |
| 139 | CC = gcc |
| 140 | fpic := -fPIC |
| 141 | LD_FLAGS := -fPIC |
| 142 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T |
| 143 | CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ |
| 144 | endif |
| 145 | |
| 146 | CFLAGS += -fPIC |
| 147 | ifneq ($(platform),qnx) |
| 148 | LDLIBS += -lpthread |
| 149 | MAIN_LDLIBS += -ldl |
| 150 | endif |
| 151 | MAIN_LDFLAGS += -shared |
| 152 | MAIN_LDLIBS += -lm -lz |
| 153 | EXTRA_LDFLAGS = |
| 154 | |
| 155 | TARGET ?= libretro.so |
| 156 | PLATFORM = libretro |
| 157 | BUILTIN_GPU ?= peops |
| 158 | SOUND_DRIVERS = libretro |
| 159 | PLUGINS = |
| 160 | NO_CONFIG_MAK = yes |
| 161 | |
| 162 | include Makefile |
| 163 | |
| 164 | # no special AS needed for gpu_neon |
| 165 | plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o: plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.S |
| 166 | $(CC) $(CFLAGS) -c $^ -o $@ |