add pollux/caanoo port, refactor things
[pcsx_rearmed.git] / Makefile
CommitLineData
b60f2812 1#CROSS_COMPILE=
f95a77f7 2AS = $(CROSS_COMPILE)as
80c2304e 3CC = $(CROSS_COMPILE)gcc
4LD = $(CROSS_COMPILE)ld
5
a80ae4a0 6ARM926 ?= 0
7ARM_CORTEXA8 ?= 1
55b0eeea 8PLATFORM ?= pandora
a80ae4a0 9USE_OSS ?= 1
10#USE_ALSA = 1
11#DRC_DBG = 1
12#PCNT = 1
13TARGET = pcsx
14
15-include Makefile.local
16
c5061935 17ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
18
a80ae4a0 19CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
bb5cf0fc 20LDFLAGS += -lz -lpthread -ldl -lpng
f95a77f7 21ifndef DEBUG
cfbd3c6e 22CFLAGS += -O2 -DNDEBUG
b60f2812 23endif
e0c692d9 24CFLAGS += $(EXTRA_CFLAGS)
25
a80ae4a0 26ifeq "$(ARCH)" "arm"
27ifeq "$(ARM_CORTEXA8)" "1"
28CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
29ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
30endif
31ifeq "$(ARM926)" "1"
32CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
33ASFLAGS += -mcpu=arm926ej-s
34endif
35endif
80c2304e 36
a80ae4a0 37# detect armv7 and NEON from the specified CPU
38HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_NEON__ 1' && echo 1)
39HAVE_ARMV7 = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_ARCH_7A__ 1' && echo 1)
de38f20e 40
80c2304e 41all: $(TARGET)
42
43# core
44OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
45 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/gte.o libpcsxcore/mdec.o \
46 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
47 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
48 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
49 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
a80ae4a0 50ifeq "$(HAVE_NEON)" "1"
8cfbda97 51OBJS += libpcsxcore/gte_neon.o
52endif
ab948f7e 53libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
54libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
55
f95a77f7 56# dynarec
7139f3c8 57ifndef NO_NEW_DRC
a80ae4a0 58libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7)
7139f3c8 59OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
7e605697 60OBJS += libpcsxcore/new_dynarec/pcsxmem.o
7139f3c8 61endif
62OBJS += libpcsxcore/new_dynarec/emu_if.o
cbbab9cd 63libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
64 libpcsxcore/new_dynarec/pcsxmem_inline.c
ab948f7e 65libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
3eb78778 66ifdef DRC_DBG
67libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
68CFLAGS += -DDRC_DBG
69endif
f95a77f7 70
e906c010 71# spu
ee849648 72OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
73 plugins/dfsound/registers.o plugins/dfsound/spu.o
6d866bb7 74plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
75 plugins/dfsound/xa.c
a80ae4a0 76ifeq "$(HAVE_NEON)" "1"
b17618c0 77OBJS += plugins/dfsound/arm_utils.o
78endif
de38f20e 79ifeq "$(USE_OSS)" "1"
80plugins/dfsound/%.o: CFLAGS += -DUSEOSS
81OBJS += plugins/dfsound/oss.o
82endif
83ifeq "$(USE_ALSA)" "1"
84plugins/dfsound/%.o: CFLAGS += -DUSEALSA
85OBJS += plugins/dfsound/alsa.o
86LDFLAGS += -lasound
87endif
88
e906c010 89# gpu
2ef486ee 90# note: code is not safe for strict-aliasing? (Castlevania problems)
ab948f7e 91plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing
a96a5eb2 92OBJS += plugins/dfxvideo/gpu.o
6d866bb7 93plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \
94 plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c
b60f2812 95ifdef X11
96LDFLAGS += -lX11 -lXv
97OBJS += plugins/dfxvideo/draw.o
98else
b60f2812 99OBJS += plugins/dfxvideo/draw_fb.o
100endif
e0c692d9 101
47bf65ab 102# cdrcimg
47bf65ab 103OBJS += plugins/cdrcimg/cdrcimg.o
e906c010 104
384f5f43 105# dfinput
4c08b9e7 106OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
384f5f43 107
80c2304e 108# gui
29a8c4f3 109OBJS += frontend/main.o frontend/plugin.o
76f7048e 110OBJS += frontend/plugin_lib.o frontend/common/readpng.o
111OBJS += frontend/common/fonts.o frontend/linux/plat.o
e0c692d9 112ifeq "$(USE_GTK)" "1"
113OBJS += maemo/hildon.o maemo/main.o
114maemo/%.o: maemo/%.c
115else
55b0eeea 116OBJS += frontend/menu.o frontend/linux/in_evdev.o
76f7048e 117OBJS += frontend/common/input.o frontend/linux/oshide.o
55b0eeea 118
119ifeq "$(PLATFORM)" "pandora"
120frontend/%.o: CFLAGS += -DVOUT_FBDEV
121OBJS += frontend/linux/fbdev.o
ccf51908 122OBJS += frontend/plat_omap.o
55b0eeea 123OBJS += frontend/plat_pandora.o
124else
125ifeq "$(PLATFORM)" "caanoo"
126OBJS += frontend/plat_pollux.o
127OBJS += frontend/warm/warm.o
ccf51908 128else
129OBJS += frontend/plat_dummy.o
a327967e 130endif
55b0eeea 131endif
132
e0c692d9 133endif # !USE_GTK
a80ae4a0 134
135ifeq "$(HAVE_NEON)" "1"
136OBJS += frontend/cspace_neon.o
137else
138OBJS += frontend/cspace.o
e0c692d9 139endif
447783f8 140ifdef X11
141frontend/%.o: CFLAGS += -DX11
142OBJS += frontend/xkb.o
143endif
72228559 144ifdef PCNT
145CFLAGS += -DPCNT
146endif
4c08b9e7 147ifndef NO_TSLIB
148frontend/%.o: CFLAGS += -DHAVE_TSLIB
149OBJS += frontend/pl_gun_ts.o
150endif
ab948f7e 151frontend/%.o: CFLAGS += -DIN_EVDEV
3c70c47b 152frontend/menu.o: frontend/revision.h
153
154frontend/revision.h: FORCE
155 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
156 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
157 @rm $@_
158.PHONY: FORCE
159
80c2304e 160
161$(TARGET): $(OBJS)
f95a77f7 162 $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
80c2304e 163
a80ae4a0 164PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
7ca0ce80 165 plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so
0d464c77 166
ee78346e 167$(PLUGINS):
168 make -C $(dir $@)
f932e54b 169
80c2304e 170clean:
ee78346e 171 $(RM) $(TARGET) $(OBJS) $(TARGET).map
172
173clean_plugins:
174 for dir in $(PLUGINS) ; do \
175 $(MAKE) -C $$(dirname $$dir) clean; done
80c2304e 176
303ee308 177# ----------- release -----------
178
179PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
180
45d45c1e 181VER ?= $(shell git describe master)
303ee308 182
ee78346e 183rel: pcsx $(PLUGINS) \
3938f69a 184 pandora/pcsx.sh pandora/pcsx.pxml.templ pandora/pcsx.png \
e3d0da26 185 pandora/picorestore pandora/readme.txt pandora/skin COPYING
303ee308 186 rm -rf out
bbd837c6 187 mkdir -p out/plugins
303ee308 188 cp -r $^ out/
3938f69a 189 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
190 rm out/pcsx.pxml.templ
bbd837c6 191 mv out/*.so out/plugins/
7ca0ce80 192 mv out/plugins/gpu_neon.so out/plugins/gpuPEOPS2.so
3938f69a 193 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i pandora/pcsx.png -c