frontend: initial libretro support
[pcsx_rearmed.git] / Makefile
CommitLineData
4132e8ca 1# Makefile for PCSX ReARMed
a80ae4a0 2
4132e8ca 3TARGET = pcsx
c5061935 4
4132e8ca 5# default CFLAGS go here, so that config can override them
a80ae4a0 6CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
4132e8ca 7LDLIBS += -lpthread -ldl -lpng -lz -lm
f95a77f7 8ifndef DEBUG
cfbd3c6e 9CFLAGS += -O2 -DNDEBUG
b60f2812 10endif
4132e8ca 11#DRC_DBG = 1
12#PCNT = 1
80c2304e 13
38c2028e 14all: config.mak target_ plugins_
de38f20e 15
4132e8ca 16ifneq ($(wildcard config.mak),)
17config.mak: ./configure
18 @echo $@ is out-of-date, running configure
19 @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh
20include config.mak
21else
22config.mak:
23 @echo "Please run ./configure before running make!"
24 @exit 1
25endif
26-include Makefile.local
80c2304e 27
28# core
29OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
3ebefe71 30 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
80c2304e 31 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
32 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
33 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
34 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
59774ed0 35OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
36ifeq "$(ARCH)" "arm"
37OBJS += libpcsxcore/gte_arm.o
38endif
a80ae4a0 39ifeq "$(HAVE_NEON)" "1"
8cfbda97 40OBJS += libpcsxcore/gte_neon.o
41endif
ac6575cd 42libpcsxcore/gte.o libpcsxcore/gte_nf.o: CFLAGS += -fno-strict-aliasing
ab948f7e 43libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
44libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
45
f95a77f7 46# dynarec
4132e8ca 47ifeq "$(USE_DYNAREC)" "1"
7139f3c8 48OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
7e605697 49OBJS += libpcsxcore/new_dynarec/pcsxmem.o
7139f3c8 50endif
51OBJS += libpcsxcore/new_dynarec/emu_if.o
b1be1eee 52libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
53 libpcsxcore/new_dynarec/pcsxmem_inline.c
ab948f7e 54libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
3eb78778 55ifdef DRC_DBG
56libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
57CFLAGS += -DDRC_DBG
58endif
4132e8ca 59ifeq "$(DRC_CACHE_BASE)" "1"
60libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
a327ad27 61endif
f95a77f7 62
e906c010 63# spu
ee849648 64OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
65 plugins/dfsound/registers.o plugins/dfsound/spu.o
6d866bb7 66plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
67 plugins/dfsound/xa.c
3a721c1f 68ifeq "$(ARCH)" "arm"
b17618c0 69OBJS += plugins/dfsound/arm_utils.o
70endif
de38f20e 71ifeq "$(USE_OSS)" "1"
72plugins/dfsound/%.o: CFLAGS += -DUSEOSS
73OBJS += plugins/dfsound/oss.o
74endif
75ifeq "$(USE_ALSA)" "1"
76plugins/dfsound/%.o: CFLAGS += -DUSEALSA
77OBJS += plugins/dfsound/alsa.o
4132e8ca 78LDLIBS += -lasound
79endif
80ifeq "$(USE_NO_SOUND)" "1"
81OBJS += plugins/dfsound/nullsnd.o
de38f20e 82endif
83
e906c010 84# gpu
62d7fa95 85OBJS += plugins/gpulib/gpu.o
90ca4913 86ifeq "$(HAVE_NEON)" "1"
62d7fa95 87OBJS += plugins/gpulib/cspace_neon.o
90ca4913 88OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
89plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
90plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
91else
62d7fa95 92OBJS += plugins/gpulib/cspace.o
2ef486ee 93# note: code is not safe for strict-aliasing? (Castlevania problems)
62d7fa95 94plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
95plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
96OBJS += plugins/dfxvideo/gpulib_if.o
90ca4913 97endif
b60f2812 98ifdef X11
4132e8ca 99LDLIBS += -lX11 `sdl-config --libs`
62d7fa95 100OBJS += plugins/gpulib/vout_sdl.o
101plugins/gpulib/vout_sdl.o: CFLAGS += `sdl-config --cflags`
b60f2812 102else
1f219c7b 103OBJS += plugins/gpulib/vout_pl.o
b60f2812 104endif
e0c692d9 105
47bf65ab 106# cdrcimg
47bf65ab 107OBJS += plugins/cdrcimg/cdrcimg.o
e906c010 108
384f5f43 109# dfinput
4c08b9e7 110OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
384f5f43 111
80c2304e 112# gui
29a8c4f3 113OBJS += frontend/main.o frontend/plugin.o
38c2028e 114OBJS += frontend/common/readpng.o frontend/common/fonts.o
115OBJS += frontend/linux/plat.o
55b0eeea 116
4132e8ca 117ifeq "$(PLATFORM)" "generic"
7badc935 118OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o
38c2028e 119USE_FRONTEND = 1
4132e8ca 120endif
55b0eeea 121ifeq "$(PLATFORM)" "pandora"
55b0eeea 122OBJS += frontend/linux/fbdev.o
dd4d5a35 123OBJS += frontend/plat_omap.o frontend/linux/xenv.o
55b0eeea 124OBJS += frontend/plat_pandora.o
38c2028e 125USE_FRONTEND = 1
4132e8ca 126endif
55b0eeea 127ifeq "$(PLATFORM)" "caanoo"
faf2b2aa 128OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
221be40d 129OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o
38c2028e 130USE_FRONTEND = 1
131endif
132ifeq "$(PLATFORM)" "maemo"
133OBJS += maemo/hildon.o maemo/main.o
134maemo/%.o: maemo/%.c
135OBJS += frontend/plugin_lib.o
136endif
137ifeq "$(PLATFORM)" "libretro"
138OBJS += frontend/libretro.o
139endif
140ifeq "$(USE_FRONTEND)" "1"
141OBJS += frontend/menu.o frontend/linux/in_evdev.o
142OBJS += frontend/common/input.o
143OBJS += frontend/plugin_lib.o
144ifeq "$(HAVE_TSLIB)" "1"
145frontend/%.o: CFLAGS += -DHAVE_TSLIB
146OBJS += frontend/pl_gun_ts.o
147endif
148else
149CFLAGS += -DNO_FRONTEND
55b0eeea 150endif
a80ae4a0 151
447783f8 152ifdef X11
153frontend/%.o: CFLAGS += -DX11
154OBJS += frontend/xkb.o
155endif
72228559 156ifdef PCNT
157CFLAGS += -DPCNT
158endif
ab948f7e 159frontend/%.o: CFLAGS += -DIN_EVDEV
38c2028e 160frontend/menu.o frontend/main.o frontend/plat_sdl.o: frontend/revision.h
3c70c47b 161
59774ed0 162libpcsxcore/gte_nf.o: libpcsxcore/gte.c
163 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
164
3c70c47b 165frontend/revision.h: FORCE
166 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
167 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
168 @rm $@_
169.PHONY: FORCE
170
90ca4913 171%.o: %.S
172 $(CC) $(CFLAGS) -c $^ -o $@
80c2304e 173
38c2028e 174target_: $(TARGET)
175
80c2304e 176$(TARGET): $(OBJS)
4132e8ca 177 $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
80c2304e 178
dd4d5a35 179clean: $(PLAT_CLEAN) clean_plugins
4132e8ca 180 $(RM) $(TARGET) $(OBJS) $(TARGET).map
0d464c77 181
4132e8ca 182ifneq ($(PLUGINS),)
dd4d5a35 183plugins_: $(PLUGINS)
184
ee78346e 185$(PLUGINS):
186 make -C $(dir $@)
f932e54b 187
ee78346e 188clean_plugins:
ea1f6f2f 189 make -C plugins/gpulib/ clean
ee78346e 190 for dir in $(PLUGINS) ; do \
191 $(MAKE) -C $$(dirname $$dir) clean; done
dd4d5a35 192else
193plugins_:
194clean_plugins:
4132e8ca 195endif
80c2304e 196
303ee308 197# ----------- release -----------
198
4132e8ca 199VER ?= $(shell git describe master)
200
dd4d5a35 201ifeq "$(PLATFORM)" "generic"
202OUT = pcsx_rearmed_$(VER)
203
204rel: pcsx $(PLUGINS) \
205 frontend/pandora/skin readme.txt COPYING
206 rm -rf $(OUT)
207 mkdir -p $(OUT)/plugins
208 mkdir -p $(OUT)/bios
209 cp -r $^ $(OUT)/
210 mv $(OUT)/*.so* $(OUT)/plugins/
211 zip -9 -r $(OUT).zip $(OUT)
212endif
213
4132e8ca 214ifeq "$(PLATFORM)" "pandora"
303ee308 215PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
216
ee78346e 217rel: pcsx $(PLUGINS) \
9e0630ab 218 frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
219 frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
303ee308 220 rm -rf out
bbd837c6 221 mkdir -p out/plugins
303ee308 222 cp -r $^ out/
3938f69a 223 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
224 rm out/pcsx.pxml.templ
bbd837c6 225 mv out/*.so out/plugins/
59f1c85c 226 mv out/plugins/gpu_unai.so out/plugins/gpuPCSX4ALL.so
ea1f6f2f 227 mv out/plugins/gpu_gles.so out/plugins/gpuGLES.so
59f1c85c 228 mv out/plugins/gpu_peops.so out/plugins/gpuPEOPS.so
9e0630ab 229 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c
4132e8ca 230endif
231
232ifeq "$(PLATFORM)" "caanoo"
233PLAT_CLEAN = caanoo_clean
234
235caanoo_clean:
236 $(RM) frontend/320240/pollux_set
237
4132e8ca 238rel: pcsx $(PLUGINS) \
239 frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
240 frontend/320240/pcsxb.png frontend/320240/skin \
241 frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \
242 frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \
243 frontend/320240/haptic_s.cfg \
244 readme.txt COPYING
245 rm -rf out
246 mkdir -p out/pcsx_rearmed/plugins
247 cp -r $^ out/pcsx_rearmed/
248 mv out/pcsx_rearmed/gpu_unai.so out/pcsx_rearmed/gpuPCSX4ALL.so
249 mv out/pcsx_rearmed/gpu_gles.so out/pcsx_rearmed/gpuGLES.so
250 mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
251 mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe
252 mv out/pcsx_rearmed/pcsx_rearmed.ini out/
253 mkdir out/pcsx_rearmed/lib/
254 cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/
255 mkdir out/pcsx_rearmed/bios/
256 cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip *
257endif