| 1 | # Makefile for PicoDrive (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 := picodrive |
| 23 | |
| 24 | asm_memory = 0 |
| 25 | asm_render = 0 |
| 26 | asm_ym2612 = 0 |
| 27 | asm_misc = 0 |
| 28 | asm_cdpico = 0 |
| 29 | asm_cdmemory = 0 |
| 30 | asm_mix = 0 |
| 31 | |
| 32 | ifeq ($(platform), unix) |
| 33 | TARGET := $(TARGET_NAME)_libretro.so |
| 34 | SHARED := -shared |
| 35 | else ifeq ($(platform), osx) |
| 36 | TARGET := $(TARGET_NAME)_libretro.dylib |
| 37 | SHARED := -dynamiclib |
| 38 | else ifeq ($(platform), ios) |
| 39 | TARGET := $(TARGET_NAME)_libretro_ios.dylib |
| 40 | SHARED := -dynamiclib |
| 41 | |
| 42 | CC = clang -arch armv7 -isysroot $(IOSSDK) -miphoneos-version-min=5.0 |
| 43 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) -miphoneos-version-min=5.0 |
| 44 | CC_AS = perl ./tools/gas-preprocessor.pl $(CC) -miphoneos-version-min=5.0 |
| 45 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -marm |
| 46 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon |
| 47 | CFLAGS += -DIOS -miphoneos-version-min=5.0 |
| 48 | |
| 49 | ARCH := arm |
| 50 | |
| 51 | use_cyclone = 0 |
| 52 | use_fame = 1 |
| 53 | use_drz80 = 0 |
| 54 | use_cz80 = 1 |
| 55 | use_sh2drc = 1 |
| 56 | use_svpdrc = 1 |
| 57 | |
| 58 | else ifeq ($(platform), ps3) |
| 59 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 60 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe |
| 61 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe |
| 62 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 63 | else ifeq ($(platform), sncps3) |
| 64 | TARGET := $(TARGET_NAME)_libretro_ps3.a |
| 65 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe |
| 66 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe |
| 67 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 68 | else ifeq ($(platform), psl1ght) |
| 69 | TARGET := $(TARGET_NAME)_libretro_psl1ght.a |
| 70 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) |
| 71 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) |
| 72 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 73 | else ifeq ($(platform), psp1) |
| 74 | TARGET := $(TARGET_NAME)_libretro_psp1.a |
| 75 | CC = psp-gcc$(EXE_EXT) |
| 76 | AR = psp-ar$(EXE_EXT) |
| 77 | CFLAGS += -DPSP -G0 |
| 78 | else ifeq ($(platform), xenon) |
| 79 | TARGET := $(TARGET_NAME)_libretro_xenon360.a |
| 80 | CC = xenon-gcc$(EXE_EXT) |
| 81 | AR = xenon-ar$(EXE_EXT) |
| 82 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ |
| 83 | else ifeq ($(platform), ngc) |
| 84 | TARGET := $(TARGET_NAME)_libretro_ngc.a |
| 85 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 86 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 87 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 88 | else ifeq ($(platform), wii) |
| 89 | TARGET := libretro_$(TARGET_NAME)_wii.a |
| 90 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) |
| 91 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) |
| 92 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ |
| 93 | else ifeq ($(platform), qnx) |
| 94 | TARGET := $(TARGET_NAME)_libretro_qnx.so |
| 95 | CC = qcc -Vgcc_ntoarmv7le |
| 96 | CC_AS = $(CC) |
| 97 | CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a9 -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 98 | ASFLAGS += -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp |
| 99 | |
| 100 | ARCH = arm |
| 101 | ARM_ASM = 1 |
| 102 | else ifneq (,$(findstring armv,$(platform))) |
| 103 | TARGET := $(TARGET_NAME)_libretro.so |
| 104 | SHARED := -shared -Wl,--no-undefined |
| 105 | ifneq (,$(findstring cortexa8,$(platform))) |
| 106 | CFLAGS += -marm -mcpu=cortex-a8 |
| 107 | ASFLAGS += -mcpu=cortex-a8 |
| 108 | else ifneq (,$(findstring cortexa9,$(platform))) |
| 109 | CFLAGS += -marm -mcpu=cortex-a9 |
| 110 | ASFLAGS += -mcpu=cortex-a9 |
| 111 | endif |
| 112 | CFLAGS += -marm |
| 113 | ifneq (,$(findstring neon,$(platform))) |
| 114 | CFLAGS += -mfpu=neon |
| 115 | ASFLAGS += -mfpu=neon |
| 116 | endif |
| 117 | ifneq (,$(findstring softfloat,$(platform))) |
| 118 | CFLAGS += -mfloat-abi=softfp |
| 119 | ASFLAGS += -mfloat-abi=softfp |
| 120 | else ifneq (,$(findstring hardfloat,$(platform))) |
| 121 | CFLAGS += -mfloat-abi=hard |
| 122 | ASFLAGS += -mfloat-abi=hard |
| 123 | endif |
| 124 | ifneq (,$(findstring armasm,$(platform))) |
| 125 | ARM_ASM = 1 |
| 126 | endif |
| 127 | ARCH = arm |
| 128 | else |
| 129 | TARGET := $(TARGET_NAME)_libretro.dll |
| 130 | CC = gcc |
| 131 | LD_FLAGS := -fPIC |
| 132 | SHARED := -shared -static-libgcc -static-libstdc++ |
| 133 | CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ |
| 134 | endif |
| 135 | |
| 136 | ifeq ($(ARM_ASM),1) |
| 137 | asm_memory = 1 |
| 138 | asm_render = 1 |
| 139 | asm_ym2612 = 1 |
| 140 | asm_misc = 1 |
| 141 | asm_cdpico = 1 |
| 142 | asm_cdmemory = 1 |
| 143 | asm_mix = 1 |
| 144 | endif |
| 145 | |
| 146 | CFLAGS += -fPIC |
| 147 | LDLIBS += -lm |
| 148 | SHARED ?= -shared |
| 149 | LDFLAGS += $(SHARED) |
| 150 | |
| 151 | PLATFORM = libretro |
| 152 | NO_CONFIG_MAK = yes |
| 153 | |
| 154 | include Makefile |