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)),)
31 ifeq ($(platform), unix)
32 TARGET := snes9x_next_libretro.so
34 SHARED := -shared -Wl,--version-script=libretro/link.T
35 else ifeq ($(platform), osx)
36 TARGET := snes9x_next_libretro.dylib
39 else ifeq ($(platform), ios)
41 TARGET := snes9x_next_libretro.dylib
45 CC = $(IOSSDK)../../usr/bin/gcc
46 CXX = $(IOSSDK)../../usr/bin/g++
47 CFLAGS += -cpu=cortex-a8 -mfpu=neon
48 ASFLAGS += -cpu=cortex-a8 -mfpu=neon
52 else ifeq ($(platform), ps3)
53 TARGET := snes9x_next_libretro_ps3.a
54 CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe
55 AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe
56 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
57 else ifeq ($(platform), sncps3)
58 TARGET := snes9x_next_libretro_ps3.a
59 CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe
60 AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe
61 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
62 else ifeq ($(platform), psl1ght)
63 TARGET := snes9x_next_libretro_psl1ght.a
64 CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT)
65 AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT)
66 CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__
67 else ifeq ($(platform), psp1)
68 TARGET := snes9x_next_libretro_psp1.a
69 CC = psp-gcc$(EXE_EXT)
72 else ifeq ($(platform), xenon)
73 TARGET := snes9x_next_libretro_xenon360.a
74 CC = xenon-gcc$(EXE_EXT)
75 AR = xenon-ar$(EXE_EXT)
76 CFLAGS += -D__LIBXENON__ -m32 -D__ppc__
77 else ifeq ($(platform), ngc)
78 TARGET := snes9x_next_libretro_ngc.a
79 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
80 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
81 CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
82 else ifeq ($(platform), wii)
83 TARGET := snes9x_next_libretro_wii.a
84 CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
85 AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT)
86 CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__
88 TARGET := snes9x_next_retro.dll
92 SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T
93 CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__
100 MAIN_LDFLAGS += -shared
101 MAIN_LDLIBS += -ldl -lm -lz
102 PLUGIN_CFLAGS += -fPIC
107 SOUND_DRIVERS = libretro
108 PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so
111 LDFLAGS += $(MAIN_LDFLAGS)
112 LDLIBS += $(MAIN_LDLIBS)
118 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
119 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
120 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
121 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
122 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
123 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
124 OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
126 OBJS += libpcsxcore/gte_arm.o
128 ifeq "$(HAVE_NEON)" "1"
129 OBJS += libpcsxcore/gte_neon.o
131 libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
134 ifeq "$(USE_DYNAREC)" "1"
135 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
136 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
138 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE
140 OBJS += libpcsxcore/new_dynarec/emu_if.o
141 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
142 libpcsxcore/new_dynarec/pcsxmem_inline.c
143 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
145 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
148 ifeq "$(DRC_CACHE_BASE)" "1"
149 libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
153 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
154 plugins/dfsound/registers.o plugins/dfsound/spu.o \
155 plugins/dfsound/out.o
156 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
159 OBJS += plugins/dfsound/arm_utils.o
161 plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
164 OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
165 ifeq "$(BUILTIN_GPU)" "neon"
166 OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
167 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
168 plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
170 ifeq "$(BUILTIN_GPU)" "peops"
171 # note: code is not safe for strict-aliasing? (Castlevania problems)
172 plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
173 plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
174 OBJS += plugins/dfxvideo/gpulib_if.o
176 ifeq "$(BUILTIN_GPU)" "unai"
177 OBJS += plugins/gpu_unai/gpulib_if.o
179 OBJS += plugins/gpu_unai/gpu_arm.o
181 plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
186 OBJS += plugins/cdrcimg/cdrcimg.o
189 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
192 OBJS += frontend/cspace.o
193 ifeq "$(HAVE_NEON)" "1"
194 OBJS += frontend/cspace_neon.o
197 OBJS += frontend/cspace_arm.o
201 CFLAGS += -DFRONTEND_SUPPORTS_RGB565 -DNO_FRONTEND
204 OBJS += frontend/libretro.o frontend/main.o frontend/plugin.o
207 frontend/menu.o frontend/main.o: frontend/revision.h
208 frontend/libretro.o: frontend/revision.h
210 libpcsxcore/gte_nf.o: libpcsxcore/gte.c
211 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
213 frontend/revision.h: FORCE
214 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
215 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
219 $(CC) $(CFLAGS) -c $^ -o $@
225 $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
227 clean: $(PLAT_CLEAN) clean_plugins
228 $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h
237 make -C plugins/gpulib/ clean
238 for dir in $(PLUGINS) ; do \
239 $(MAKE) -C $$(dirname $$dir) clean; done
245 .PHONY: all clean target_ plugins_ clean_plugins FORCE