1 # Makefile for PCSX ReARMed (libretro)
3 # default stuff goes here, so that config can override
4 CFLAGS += -Wall -ggdb -Iinclude -ffast-math
16 ifeq ($(shell uname -a),)
18 else ifneq ($(findstring MINGW,$(shell uname -a)),)
20 else ifneq ($(findstring Darwin,$(shell uname -a)),)
22 else ifneq ($(findstring win,$(shell uname -a)),)
32 ifeq ($(platform), unix)
33 TARGET := snes9x_next_libretro.so
35 SHARED := -shared -Wl,--version-script=libretro/link.T
36 else ifeq ($(platform), osx)
37 TARGET := snes9x_next_libretro.dylib
40 else ifeq ($(platform), ios)
42 TARGET := snes9x_next_libretro.dylib
46 CC = clang -arch armv7 -isysroot $(IOSSDK)
47 CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
48 CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
49 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
50 ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon
53 else ifeq ($(platform), ps3)
54 TARGET := snes9x_next_libretro_ps3.a
55 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
56 AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
57 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
58 else ifeq ($(platform), sncps3)
59 TARGET := snes9x_next_libretro_ps3.a
60 CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
61 AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
62 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
63 else ifeq ($(platform), psl1ght)
64 TARGET := snes9x_next_libretro_psl1ght.a
65 CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
66 AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
67 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
68 else ifeq ($(platform), psp1)
69 TARGET := snes9x_next_libretro_psp1.a
70 CC = psp-gcc$(EXE_EXT)
73 else ifeq ($(platform), xenon)
74 TARGET := snes9x_next_libretro_xenon360.a
75 CC = xenon-gcc$(EXE_EXT)
76 AR = xenon-ar$(EXE_EXT)
77 CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
78 else ifeq ($(platform), ngc)
79 TARGET := snes9x_next_libretro_ngc.a
80 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
81 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
82 CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
83 else ifeq ($(platform), wii)
84 TARGET := snes9x_next_libretro_wii.a
85 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
86 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
87 CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
88 else ifeq ($(platform), qnx)
89 TARGET := libretro_pcsx_rearmed_qnx.so
95 CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
96 ASFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp
98 TARGET := snes9x_next_retro.dll
102 SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T
103 CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__
110 ifneq ($(platform),qnx)
114 MAIN_LDFLAGS += -shared
115 MAIN_LDLIBS += -lm -lz
116 PLUGIN_CFLAGS += -fPIC
118 TARGET ?= libretro.so
121 SOUND_DRIVERS = libretro
122 #PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so
125 LDFLAGS += $(MAIN_LDFLAGS)
126 LDLIBS += $(MAIN_LDLIBS)
132 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
133 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
134 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
135 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
136 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
137 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
138 OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
140 OBJS += libpcsxcore/gte_arm.o
142 ifeq "$(HAVE_NEON)" "1"
143 OBJS += libpcsxcore/gte_neon.o
145 libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
148 ifeq "$(USE_DYNAREC)" "1"
149 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
150 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
152 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE
154 OBJS += libpcsxcore/new_dynarec/emu_if.o
155 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
156 libpcsxcore/new_dynarec/pcsxmem_inline.c
157 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
159 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
162 ifeq "$(DRC_CACHE_BASE)" "1"
163 libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
167 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
168 plugins/dfsound/registers.o plugins/dfsound/spu.o \
169 plugins/dfsound/out.o
170 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
173 OBJS += plugins/dfsound/arm_utils.o
175 plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
178 OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
179 ifeq "$(BUILTIN_GPU)" "neon"
180 OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
181 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
182 plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
184 ifeq "$(BUILTIN_GPU)" "peops"
185 # note: code is not safe for strict-aliasing? (Castlevania problems)
186 plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
187 plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
188 OBJS += plugins/dfxvideo/gpulib_if.o
190 ifeq "$(BUILTIN_GPU)" "unai"
191 OBJS += plugins/gpu_unai/gpulib_if.o
193 OBJS += plugins/gpu_unai/gpu_arm.o
195 plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
200 OBJS += plugins/cdrcimg/cdrcimg.o
203 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
206 OBJS += frontend/cspace.o
207 ifeq "$(HAVE_NEON)" "1"
208 OBJS += frontend/cspace_neon.o
211 OBJS += frontend/cspace_arm.o
215 CFLAGS += -DFRONTEND_SUPPORTS_RGB565 -DNO_FRONTEND
218 OBJS += frontend/libretro.o frontend/main.o frontend/plugin.o
221 frontend/menu.o frontend/main.o: frontend/revision.h
222 frontend/libretro.o: frontend/revision.h
224 libpcsxcore/gte_nf.o: libpcsxcore/gte.c
225 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
227 frontend/revision.h: FORCE
228 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
229 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
233 $(CC_AS) $(CFLAGS) -c $^ -o $@
236 $(CC) $(ASFLAGS) -c $^ -o $@
242 $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
244 clean: $(PLAT_CLEAN) clean_plugins
245 $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h
254 make -C plugins/gpulib/ clean
255 for dir in $(PLUGINS) ; do \
256 $(MAKE) -C $$(dirname $$dir) clean; done
262 .PHONY: all clean target_ plugins_ clean_plugins FORCE