switch over to libpicofe
[pcsx_rearmed.git] / Makefile
CommitLineData
4132e8ca 1# Makefile for PCSX ReARMed
a80ae4a0 2
61bc6d40 3# default stuff goes here, so that config can override
4132e8ca 4TARGET = pcsx
a80ae4a0 5CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
f89fa2d9 6LDLIBS += -lpthread
f95a77f7 7ifndef DEBUG
cfbd3c6e 8CFLAGS += -O2 -DNDEBUG
b60f2812 9endif
61bc6d40 10CXXFLAGS += $(CFLAGS)
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
61bc6d40 28CC_LINK = $(CC)
07c13dfd 29LDLIBS += $(MAIN_LDLIBS)
61bc6d40 30
80c2304e 31# core
32OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
3ebefe71 33 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
80c2304e 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
59774ed0 38OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
39ifeq "$(ARCH)" "arm"
40OBJS += libpcsxcore/gte_arm.o
41endif
a80ae4a0 42ifeq "$(HAVE_NEON)" "1"
8cfbda97 43OBJS += libpcsxcore/gte_neon.o
44endif
ac6575cd 45libpcsxcore/gte.o libpcsxcore/gte_nf.o: CFLAGS += -fno-strict-aliasing
ab948f7e 46libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
47libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
48
f95a77f7 49# dynarec
4132e8ca 50ifeq "$(USE_DYNAREC)" "1"
7139f3c8 51OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
7e605697 52OBJS += libpcsxcore/new_dynarec/pcsxmem.o
7139f3c8 53endif
54OBJS += libpcsxcore/new_dynarec/emu_if.o
b1be1eee 55libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
56 libpcsxcore/new_dynarec/pcsxmem_inline.c
ab948f7e 57libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
3eb78778 58ifdef DRC_DBG
59libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
60CFLAGS += -DDRC_DBG
61endif
4132e8ca 62ifeq "$(DRC_CACHE_BASE)" "1"
63libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
a327ad27 64endif
f95a77f7 65
e906c010 66# spu
ee849648 67OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
07c13dfd 68 plugins/dfsound/registers.o plugins/dfsound/spu.o \
69 plugins/dfsound/out.o plugins/dfsound/nullsnd.o
6d866bb7 70plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
71 plugins/dfsound/xa.c
3a721c1f 72ifeq "$(ARCH)" "arm"
b17618c0 73OBJS += plugins/dfsound/arm_utils.o
74endif
07c13dfd 75ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
76plugins/dfsound/out.o: CFLAGS += -DHAVE_OSS
de38f20e 77OBJS += plugins/dfsound/oss.o
78endif
07c13dfd 79ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
80plugins/dfsound/out.o: CFLAGS += -DHAVE_ALSA
de38f20e 81OBJS += plugins/dfsound/alsa.o
4132e8ca 82LDLIBS += -lasound
83endif
07c13dfd 84ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
85plugins/dfsound/out.o: CFLAGS += -DHAVE_SDL
d8a2f79b 86OBJS += plugins/dfsound/sdl.o
87endif
07c13dfd 88ifneq ($(findstring pulseaudio,$(SOUND_DRIVERS)),)
89plugins/dfsound/out.o: CFLAGS += -DHAVE_PULSE
90OBJS += plugins/dfsound/pulseaudio.o
91endif
92ifneq ($(findstring libretro,$(SOUND_DRIVERS)),)
93plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
de38f20e 94endif
95
61bc6d40 96# builtin gpu
97OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
90ca4913 98ifeq "$(HAVE_NEON)" "1"
62d7fa95 99OBJS += plugins/gpulib/cspace_neon.o
61bc6d40 100else
101OBJS += plugins/gpulib/cspace.o
102endif
103ifeq "$(BUILTIN_GPU)" "neon"
90ca4913 104OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
105plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
106plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
61bc6d40 107endif
108ifeq "$(BUILTIN_GPU)" "peops"
2ef486ee 109# note: code is not safe for strict-aliasing? (Castlevania problems)
62d7fa95 110plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
111plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
112OBJS += plugins/dfxvideo/gpulib_if.o
90ca4913 113endif
61bc6d40 114ifeq "$(BUILTIN_GPU)" "unai"
115OBJS += plugins/gpulib/cspace.o
116OBJS += plugins/gpu_unai/gpulib_if.o
117ifeq "$(ARCH)" "arm"
118OBJS += plugins/gpu_unai/gpu_arm.o
119endif
4ea086f6 120plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
61bc6d40 121CC_LINK = $(CXX)
b60f2812 122endif
e0c692d9 123
47bf65ab 124# cdrcimg
47bf65ab 125OBJS += plugins/cdrcimg/cdrcimg.o
e906c010 126
384f5f43 127# dfinput
4c08b9e7 128OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
384f5f43 129
cc56203b 130# frontend/gui
4132e8ca 131ifeq "$(PLATFORM)" "generic"
cc56203b 132OBJS += frontend/libpicofe/in_sdl.o frontend/plat_sdl.o
133OBJS += frontend/libpicofe/plat_dummy.o
134OBJS += frontend/libpicofe/linux/in_evdev.o
135USE_PLUGIN_LIB = 1
38c2028e 136USE_FRONTEND = 1
4132e8ca 137endif
55b0eeea 138ifeq "$(PLATFORM)" "pandora"
cc56203b 139OBJS += frontend/libpicofe/pandora/plat.o
140OBJS += frontend/libpicofe/linux/fbdev.o frontend/libpicofe/linux/xenv.o
141OBJS += frontend/libpicofe/linux/in_evdev.o
142OBJS += frontend/plat_pandora.o frontend/plat_omap.o
143USE_PLUGIN_LIB = 1
38c2028e 144USE_FRONTEND = 1
4132e8ca 145endif
55b0eeea 146ifeq "$(PLATFORM)" "caanoo"
cc56203b 147OBJS += frontend/libpicofe/gp2x/in_gp2x.o frontend/warm/warm.o
148OBJS += frontend/libpicofe/gp2x/soc_pollux.o
149OBJS += frontend/libpicofe/linux/in_evdev.o
faf2b2aa 150OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
5b9f1b9e 151libpcsxcore/new_dynarec/pcsxmem.o: CFLAGS += -DCUSTOM_MEMMAPS
cc56203b 152USE_PLUGIN_LIB = 1
38c2028e 153USE_FRONTEND = 1
154endif
155ifeq "$(PLATFORM)" "maemo"
156OBJS += maemo/hildon.o maemo/main.o
157maemo/%.o: maemo/%.c
cc56203b 158USE_PLUGIN_LIB = 1
38c2028e 159endif
160ifeq "$(PLATFORM)" "libretro"
161OBJS += frontend/libretro.o
cc56203b 162OBJS += frontend/linux/plat_mmap.o
38c2028e 163endif
cc56203b 164
165ifeq "$(USE_PLUGIN_LIB)" "1"
38c2028e 166OBJS += frontend/plugin_lib.o
cc56203b 167OBJS += frontend/libpicofe/linux/plat.o
168OBJS += frontend/libpicofe/readpng.o frontend/libpicofe/fonts.o
169ifeq "$(HAVE_NEON)" "1"
170OBJS += frontend/libpicofe/arm/neon_scale2x.o
171OBJS += frontend/libpicofe/arm/neon_eagle2x.o
172frontend/libpicofe/arm/neon_scale2x.o: CFLAGS += -DDO_BGR_TO_RGB
173frontend/libpicofe/arm/neon_eagle2x.o: CFLAGS += -DDO_BGR_TO_RGB
174endif
175endif
176ifeq "$(USE_FRONTEND)" "1"
177OBJS += frontend/menu.o
178OBJS += frontend/libpicofe/input.o
179frontend/menu.o: frontend/libpicofe/menu.c
38c2028e 180ifeq "$(HAVE_TSLIB)" "1"
181frontend/%.o: CFLAGS += -DHAVE_TSLIB
182OBJS += frontend/pl_gun_ts.o
183endif
184else
185CFLAGS += -DNO_FRONTEND
55b0eeea 186endif
a80ae4a0 187
447783f8 188ifdef X11
189frontend/%.o: CFLAGS += -DX11
190OBJS += frontend/xkb.o
191endif
72228559 192ifdef PCNT
193CFLAGS += -DPCNT
194endif
cc56203b 195
196# misc
197OBJS += frontend/main.o frontend/plugin.o
198
ab948f7e 199frontend/%.o: CFLAGS += -DIN_EVDEV
38c2028e 200frontend/menu.o frontend/main.o frontend/plat_sdl.o: frontend/revision.h
3c70c47b 201
cc56203b 202frontend/libpicofe/%.c:
fa56d360 203 @echo "libpicofe module is missing, please run:"
204 @echo "git submodule init && git submodule update"
205 @exit 1
206
207
59774ed0 208libpcsxcore/gte_nf.o: libpcsxcore/gte.c
209 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
210
3c70c47b 211frontend/revision.h: FORCE
212 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
213 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
214 @rm $@_
3c70c47b 215
90ca4913 216%.o: %.S
217 $(CC) $(CFLAGS) -c $^ -o $@
80c2304e 218
38c2028e 219target_: $(TARGET)
220
80c2304e 221$(TARGET): $(OBJS)
61bc6d40 222 $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
80c2304e 223
dd4d5a35 224clean: $(PLAT_CLEAN) clean_plugins
4132e8ca 225 $(RM) $(TARGET) $(OBJS) $(TARGET).map
0d464c77 226
4132e8ca 227ifneq ($(PLUGINS),)
dd4d5a35 228plugins_: $(PLUGINS)
229
ee78346e 230$(PLUGINS):
231 make -C $(dir $@)
f932e54b 232
ee78346e 233clean_plugins:
ea1f6f2f 234 make -C plugins/gpulib/ clean
ee78346e 235 for dir in $(PLUGINS) ; do \
236 $(MAKE) -C $$(dirname $$dir) clean; done
dd4d5a35 237else
238plugins_:
239clean_plugins:
4132e8ca 240endif
80c2304e 241
fa56d360 242.PHONY: all clean target_ plugins_ clean_plugins FORCE
243
303ee308 244# ----------- release -----------
245
cd5abe38 246VER ?= $(shell git describe HEAD)
4132e8ca 247
dd4d5a35 248ifeq "$(PLATFORM)" "generic"
249OUT = pcsx_rearmed_$(VER)
250
251rel: pcsx $(PLUGINS) \
252 frontend/pandora/skin readme.txt COPYING
253 rm -rf $(OUT)
254 mkdir -p $(OUT)/plugins
255 mkdir -p $(OUT)/bios
256 cp -r $^ $(OUT)/
257 mv $(OUT)/*.so* $(OUT)/plugins/
258 zip -9 -r $(OUT).zip $(OUT)
259endif
260
4132e8ca 261ifeq "$(PLATFORM)" "pandora"
303ee308 262PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
263
ee78346e 264rel: pcsx $(PLUGINS) \
9e0630ab 265 frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
266 frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
303ee308 267 rm -rf out
bbd837c6 268 mkdir -p out/plugins
303ee308 269 cp -r $^ out/
3938f69a 270 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
271 rm out/pcsx.pxml.templ
bbd837c6 272 mv out/*.so out/plugins/
9e0630ab 273 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c
4132e8ca 274endif
275
276ifeq "$(PLATFORM)" "caanoo"
277PLAT_CLEAN = caanoo_clean
278
279caanoo_clean:
280 $(RM) frontend/320240/pollux_set
281
4132e8ca 282rel: pcsx $(PLUGINS) \
283 frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
284 frontend/320240/pcsxb.png frontend/320240/skin \
285 frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \
286 frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \
287 frontend/320240/haptic_s.cfg \
288 readme.txt COPYING
289 rm -rf out
290 mkdir -p out/pcsx_rearmed/plugins
291 cp -r $^ out/pcsx_rearmed/
4132e8ca 292 mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
293 mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe
294 mv out/pcsx_rearmed/pcsx_rearmed.ini out/
295 mkdir out/pcsx_rearmed/lib/
296 cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/
297 mkdir out/pcsx_rearmed/bios/
298 cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip *
299endif