Commit | Line | Data |
---|---|---|
d02d2725 | 1 | # Makefile for PCSX ReARMed (libretro) |
2 | ||
3 | # default stuff goes here, so that config can override | |
4 | CFLAGS += -Wall -ggdb -Iinclude -ffast-math | |
5 | ifndef DEBUG | |
6 | CFLAGS += -O2 -DNDEBUG | |
7 | endif | |
8 | CXXFLAGS += $(CFLAGS) | |
9 | #DRC_DBG = 1 | |
10 | #PCNT = 1 | |
11 | ||
12 | all: target_ plugins_ | |
13 | ||
6e1ff5d2 | 14 | ifeq ($(platform),) |
15 | platform = unix | |
16 | ifeq ($(shell uname -a),) | |
17 | platform = win | |
18 | else ifneq ($(findstring MINGW,$(shell uname -a)),) | |
19 | platform = win | |
20 | else ifneq ($(findstring Darwin,$(shell uname -a)),) | |
21 | platform = osx | |
22 | else ifneq ($(findstring win,$(shell uname -a)),) | |
23 | platform = win | |
24 | endif | |
25 | endif | |
26 | ||
51014e87 C |
27 | CC ?= gcc |
28 | CXX ?= g++ | |
29 | AS ?= as | |
6e1ff5d2 | 30 | |
31 | ifeq ($(platform), unix) | |
32 | TARGET := snes9x_next_libretro.so | |
33 | fpic := -fPIC | |
34 | SHARED := -shared -Wl,--version-script=libretro/link.T | |
35 | else ifeq ($(platform), osx) | |
36 | TARGET := snes9x_next_libretro.dylib | |
37 | fpic := -fPIC | |
38 | SHARED := -dynamiclib | |
39 | else ifeq ($(platform), ios) | |
40 | ARCH := arm | |
41 | TARGET := snes9x_next_libretro.dylib | |
42 | fpic := -fPIC | |
43 | SHARED := -dynamiclib | |
44 | ||
ab82eb7d | 45 | CC = clang -arch armv7 -isysroot $(IOSSDK) |
46 | CXX = clang++ -arch armv7 -isysroot $(IOSSDK) | |
47 | CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon | |
48 | ASFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon | |
6e1ff5d2 | 49 | HAVE_NEON = 1 |
50 | CFLAGS += -DIOS | |
51 | else ifeq ($(platform), ps3) | |
52 | TARGET := snes9x_next_libretro_ps3.a | |
53 | CC = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-gcc.exe | |
54 | AR = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-ar.exe | |
55 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
56 | else ifeq ($(platform), sncps3) | |
57 | TARGET := snes9x_next_libretro_ps3.a | |
58 | CC = $(CELL_SDK)/host-win32/sn/bin/ps3ppusnc.exe | |
59 | AR = $(CELL_SDK)/host-win32/sn/bin/ps3snarl.exe | |
60 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
61 | else ifeq ($(platform), psl1ght) | |
62 | TARGET := snes9x_next_libretro_psl1ght.a | |
63 | CC = $(PS3DEV)/ppu/bin/ppu-gcc$(EXE_EXT) | |
64 | AR = $(PS3DEV)/ppu/bin/ppu-ar$(EXE_EXT) | |
65 | CFLAGS += -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
66 | else ifeq ($(platform), psp1) | |
67 | TARGET := snes9x_next_libretro_psp1.a | |
68 | CC = psp-gcc$(EXE_EXT) | |
69 | AR = psp-ar$(EXE_EXT) | |
70 | CFLAGS += -DPSP -G0 | |
71 | else ifeq ($(platform), xenon) | |
72 | TARGET := snes9x_next_libretro_xenon360.a | |
73 | CC = xenon-gcc$(EXE_EXT) | |
74 | AR = xenon-ar$(EXE_EXT) | |
75 | CFLAGS += -D__LIBXENON__ -m32 -D__ppc__ | |
76 | else ifeq ($(platform), ngc) | |
77 | TARGET := snes9x_next_libretro_ngc.a | |
78 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) | |
79 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) | |
80 | CFLAGS += -DGEKKO -DHW_DOL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
81 | else ifeq ($(platform), wii) | |
82 | TARGET := snes9x_next_libretro_wii.a | |
83 | CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT) | |
84 | AR = $(DEVKITPPC)/bin/powerpc-eabi-ar$(EXE_EXT) | |
85 | CFLAGS += -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float -DBLARGG_BIG_ENDIAN=1 -D__ppc__ | |
51014e87 C |
86 | else ifeq ($(platform), qnx) |
87 | TARGET := libretro_pcsx_rearmed_qnx.so | |
88 | HAVE_NEON = 1 | |
89 | USE_DYNAREC = 1 | |
90 | DRC_CACHE_BASE = 0 | |
91 | BUILTIN_GPU = neon | |
92 | ARCH = arm | |
93 | CFLAGS += -DBASE_ADDR_FIXED=0 -D__BLACKBERRY_QNX__ -marm -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp | |
94 | ASFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp | |
6e1ff5d2 | 95 | else |
96 | TARGET := snes9x_next_retro.dll | |
97 | CC = gcc | |
98 | fpic := -fPIC | |
99 | LD_FLAGS := -fPIC | |
100 | SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=libretro/link.T | |
101 | CFLAGS += -D__WIN32__ -D__WIN32_LIBRETRO__ | |
102 | endif | |
103 | ||
104 | CFLAGS += -fPIC | |
d02d2725 | 105 | ASFLAGS += |
106 | LDFLAGS += | |
51014e87 C |
107 | |
108 | ifneq ($(platform),qnx) | |
109 | LDLIBS += -lpthread | |
110 | MAIN_LDLIBS += -ldl | |
111 | endif | |
6e1ff5d2 | 112 | MAIN_LDFLAGS += -shared |
51014e87 | 113 | MAIN_LDLIBS += -lm -lz |
d02d2725 | 114 | PLUGIN_CFLAGS += -fPIC |
115 | ||
51014e87 | 116 | TARGET ?= libretro.so |
d02d2725 | 117 | PLATFORM = libretro |
51014e87 | 118 | BUILTIN_GPU ?= peops |
d02d2725 | 119 | SOUND_DRIVERS = libretro |
51014e87 | 120 | #PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so |
d02d2725 | 121 | |
122 | CC_LINK = $(CC) | |
123 | LDFLAGS += $(MAIN_LDFLAGS) | |
124 | LDLIBS += $(MAIN_LDLIBS) | |
125 | ifdef PCNT | |
126 | CFLAGS += -DPCNT | |
127 | endif | |
128 | ||
129 | # core | |
130 | OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \ | |
131 | libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \ | |
132 | libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \ | |
133 | libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \ | |
134 | libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \ | |
135 | libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o | |
136 | OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o | |
137 | ifeq "$(ARCH)" "arm" | |
138 | OBJS += libpcsxcore/gte_arm.o | |
139 | endif | |
140 | ifeq "$(HAVE_NEON)" "1" | |
141 | OBJS += libpcsxcore/gte_neon.o | |
142 | endif | |
143 | libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull | |
144 | ||
145 | # dynarec | |
146 | ifeq "$(USE_DYNAREC)" "1" | |
147 | OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o | |
148 | OBJS += libpcsxcore/new_dynarec/pcsxmem.o | |
149 | else | |
150 | libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE | |
151 | endif | |
152 | OBJS += libpcsxcore/new_dynarec/emu_if.o | |
153 | libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \ | |
154 | libpcsxcore/new_dynarec/pcsxmem_inline.c | |
155 | libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign | |
156 | ifdef DRC_DBG | |
157 | libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64 | |
158 | CFLAGS += -DDRC_DBG | |
159 | endif | |
160 | ifeq "$(DRC_CACHE_BASE)" "1" | |
161 | libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1 | |
162 | endif | |
163 | ||
164 | # spu | |
165 | OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \ | |
166 | plugins/dfsound/registers.o plugins/dfsound/spu.o \ | |
167 | plugins/dfsound/out.o | |
168 | plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \ | |
169 | plugins/dfsound/xa.c | |
170 | ifeq "$(ARCH)" "arm" | |
171 | OBJS += plugins/dfsound/arm_utils.o | |
172 | endif | |
173 | plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO | |
174 | ||
175 | # builtin gpu | |
176 | OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o | |
177 | ifeq "$(BUILTIN_GPU)" "neon" | |
178 | OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o | |
179 | plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP | |
180 | plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c | |
181 | endif | |
182 | ifeq "$(BUILTIN_GPU)" "peops" | |
183 | # note: code is not safe for strict-aliasing? (Castlevania problems) | |
184 | plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing | |
185 | plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c | |
186 | OBJS += plugins/dfxvideo/gpulib_if.o | |
187 | endif | |
188 | ifeq "$(BUILTIN_GPU)" "unai" | |
189 | OBJS += plugins/gpu_unai/gpulib_if.o | |
190 | ifeq "$(ARCH)" "arm" | |
191 | OBJS += plugins/gpu_unai/gpu_arm.o | |
192 | endif | |
193 | plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3 | |
194 | CC_LINK = $(CXX) | |
195 | endif | |
196 | ||
197 | # cdrcimg | |
198 | OBJS += plugins/cdrcimg/cdrcimg.o | |
199 | ||
200 | # dfinput | |
201 | OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o | |
202 | ||
203 | # frontend/gui | |
204 | OBJS += frontend/cspace.o | |
205 | ifeq "$(HAVE_NEON)" "1" | |
206 | OBJS += frontend/cspace_neon.o | |
207 | else | |
208 | ifeq "$(ARCH)" "arm" | |
209 | OBJS += frontend/cspace_arm.o | |
210 | endif | |
211 | endif | |
212 | ||
213 | CFLAGS += -DFRONTEND_SUPPORTS_RGB565 -DNO_FRONTEND | |
214 | ||
215 | # misc | |
216 | OBJS += frontend/libretro.o frontend/main.o frontend/plugin.o | |
217 | ||
218 | ||
219 | frontend/menu.o frontend/main.o: frontend/revision.h | |
220 | frontend/libretro.o: frontend/revision.h | |
221 | ||
222 | libpcsxcore/gte_nf.o: libpcsxcore/gte.c | |
223 | $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS | |
224 | ||
225 | frontend/revision.h: FORCE | |
226 | @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_ | |
227 | @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@ | |
228 | @rm $@_ | |
229 | ||
230 | %.o: %.S | |
231 | $(CC) $(CFLAGS) -c $^ -o $@ | |
51014e87 C |
232 | |
233 | %.o: %.s | |
234 | $(CC) $(ASFLAGS) -c $^ -o $@ | |
d02d2725 | 235 | |
236 | ||
237 | target_: $(TARGET) | |
238 | ||
239 | $(TARGET): $(OBJS) | |
240 | $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map | |
241 | ||
242 | clean: $(PLAT_CLEAN) clean_plugins | |
243 | $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h | |
244 | ||
245 | ifneq ($(PLUGINS),) | |
246 | plugins_: $(PLUGINS) | |
247 | ||
248 | $(PLUGINS): | |
249 | make -C $(dir $@) | |
250 | ||
251 | clean_plugins: | |
252 | make -C plugins/gpulib/ clean | |
253 | for dir in $(PLUGINS) ; do \ | |
254 | $(MAKE) -C $$(dirname $$dir) clean; done | |
255 | else | |
256 | plugins_: | |
257 | clean_plugins: | |
258 | endif | |
259 | ||
260 | .PHONY: all clean target_ plugins_ clean_plugins FORCE |