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