1 # Makefile for PCSX ReARMed
3 # default stuff goes here, so that config can override
5 CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
6 LDLIBS += -lpthread -lm
14 all: config.mak target_ plugins_
16 ifneq ($(wildcard config.mak),)
17 config.mak: ./configure
18 @echo $@ is out-of-date, running configure
19 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
23 @echo "Please run ./configure before running make!"
26 -include Makefile.local
29 LDLIBS += $(MAIN_LDLIBS)
32 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
33 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
34 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
35 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
36 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
37 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
38 OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
40 OBJS += libpcsxcore/gte_arm.o
42 ifeq "$(HAVE_NEON)" "1"
43 OBJS += libpcsxcore/gte_neon.o
45 libpcsxcore/gte.o libpcsxcore/gte_nf.o: CFLAGS += -fno-strict-aliasing
46 libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
47 libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
50 ifeq "$(USE_DYNAREC)" "1"
51 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
52 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
54 OBJS += libpcsxcore/new_dynarec/emu_if.o
55 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
56 libpcsxcore/new_dynarec/pcsxmem_inline.c
57 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
59 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
62 ifeq "$(DRC_CACHE_BASE)" "1"
63 libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
67 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
68 plugins/dfsound/registers.o plugins/dfsound/spu.o \
69 plugins/dfsound/out.o plugins/dfsound/nullsnd.o
70 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
73 OBJS += plugins/dfsound/arm_utils.o
75 ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
76 plugins/dfsound/out.o: CFLAGS += -DHAVE_OSS
77 OBJS += plugins/dfsound/oss.o
79 ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
80 plugins/dfsound/out.o: CFLAGS += -DHAVE_ALSA
81 OBJS += plugins/dfsound/alsa.o
84 ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
85 plugins/dfsound/out.o: CFLAGS += -DHAVE_SDL
86 OBJS += plugins/dfsound/sdl.o
88 ifneq ($(findstring pulseaudio,$(SOUND_DRIVERS)),)
89 plugins/dfsound/out.o: CFLAGS += -DHAVE_PULSE
90 OBJS += plugins/dfsound/pulseaudio.o
92 ifneq ($(findstring libretro,$(SOUND_DRIVERS)),)
93 plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
97 OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
98 ifeq "$(HAVE_NEON)" "1"
99 OBJS += plugins/gpulib/cspace_neon.o
101 OBJS += plugins/gpulib/cspace.o
103 ifeq "$(BUILTIN_GPU)" "neon"
104 OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
105 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
106 plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
108 ifeq "$(BUILTIN_GPU)" "peops"
109 # note: code is not safe for strict-aliasing? (Castlevania problems)
110 plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
111 plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
112 OBJS += plugins/dfxvideo/gpulib_if.o
114 ifeq "$(BUILTIN_GPU)" "unai"
115 OBJS += plugins/gpulib/cspace.o
116 OBJS += plugins/gpu_unai/gpulib_if.o
118 OBJS += plugins/gpu_unai/gpu_arm.o
120 plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
125 OBJS += plugins/cdrcimg/cdrcimg.o
128 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
131 OBJS += frontend/main.o frontend/plugin.o
132 OBJS += frontend/common/readpng.o frontend/common/fonts.o
133 OBJS += frontend/linux/plat.o
135 ifeq "$(PLATFORM)" "generic"
136 OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o
139 ifeq "$(PLATFORM)" "pandora"
140 OBJS += frontend/linux/fbdev.o
141 OBJS += frontend/plat_omap.o frontend/linux/xenv.o
142 OBJS += frontend/plat_pandora.o
145 ifeq "$(PLATFORM)" "caanoo"
146 OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
147 OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o
150 ifeq "$(PLATFORM)" "maemo"
151 OBJS += maemo/hildon.o maemo/main.o
153 OBJS += frontend/plugin_lib.o
155 ifeq "$(PLATFORM)" "libretro"
156 OBJS += frontend/libretro.o
158 ifeq "$(USE_FRONTEND)" "1"
159 OBJS += frontend/menu.o frontend/linux/in_evdev.o
160 OBJS += frontend/common/input.o
161 OBJS += frontend/plugin_lib.o
162 ifeq "$(HAVE_TSLIB)" "1"
163 frontend/%.o: CFLAGS += -DHAVE_TSLIB
164 OBJS += frontend/pl_gun_ts.o
167 CFLAGS += -DNO_FRONTEND
171 frontend/%.o: CFLAGS += -DX11
172 OBJS += frontend/xkb.o
177 frontend/%.o: CFLAGS += -DIN_EVDEV
178 frontend/menu.o frontend/main.o frontend/plat_sdl.o: frontend/revision.h
180 libpcsxcore/gte_nf.o: libpcsxcore/gte.c
181 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
183 frontend/revision.h: FORCE
184 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
185 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
190 $(CC) $(CFLAGS) -c $^ -o $@
195 $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
197 clean: $(PLAT_CLEAN) clean_plugins
198 $(RM) $(TARGET) $(OBJS) $(TARGET).map
207 make -C plugins/gpulib/ clean
208 for dir in $(PLUGINS) ; do \
209 $(MAKE) -C $$(dirname $$dir) clean; done
215 # ----------- release -----------
217 VER ?= $(shell git describe master)
219 ifeq "$(PLATFORM)" "generic"
220 OUT = pcsx_rearmed_$(VER)
222 rel: pcsx $(PLUGINS) \
223 frontend/pandora/skin readme.txt COPYING
225 mkdir -p $(OUT)/plugins
228 mv $(OUT)/*.so* $(OUT)/plugins/
229 zip -9 -r $(OUT).zip $(OUT)
232 ifeq "$(PLATFORM)" "pandora"
233 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
235 rel: pcsx $(PLUGINS) \
236 frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
237 frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
241 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
242 rm out/pcsx.pxml.templ
243 mv out/*.so out/plugins/
244 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c
247 ifeq "$(PLATFORM)" "caanoo"
248 PLAT_CLEAN = caanoo_clean
251 $(RM) frontend/320240/pollux_set
253 rel: pcsx $(PLUGINS) \
254 frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
255 frontend/320240/pcsxb.png frontend/320240/skin \
256 frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \
257 frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \
258 frontend/320240/haptic_s.cfg \
261 mkdir -p out/pcsx_rearmed/plugins
262 cp -r $^ out/pcsx_rearmed/
263 mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
264 mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe
265 mv out/pcsx_rearmed/pcsx_rearmed.ini out/
266 mkdir out/pcsx_rearmed/lib/
267 cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/
268 mkdir out/pcsx_rearmed/bios/
269 cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip *