gte: switch divider back to table
[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 \
3ebefe71 45 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
80c2304e 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
3ebefe71 50OBJS += libpcsxcore/gte.o libpcsxcore/gte_divider.o
a80ae4a0 51ifeq "$(HAVE_NEON)" "1"
8cfbda97 52OBJS += libpcsxcore/gte_neon.o
53endif
ab948f7e 54libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
55libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
56
f95a77f7 57# dynarec
7139f3c8 58ifndef NO_NEW_DRC
a80ae4a0 59libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7)
7139f3c8 60OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
7e605697 61OBJS += libpcsxcore/new_dynarec/pcsxmem.o
7139f3c8 62endif
63OBJS += libpcsxcore/new_dynarec/emu_if.o
cbbab9cd 64libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
65 libpcsxcore/new_dynarec/pcsxmem_inline.c
ab948f7e 66libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
3eb78778 67ifdef DRC_DBG
68libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
69CFLAGS += -DDRC_DBG
70endif
f95a77f7 71
e906c010 72# spu
ee849648 73OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
74 plugins/dfsound/registers.o plugins/dfsound/spu.o
6d866bb7 75plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
76 plugins/dfsound/xa.c
a80ae4a0 77ifeq "$(HAVE_NEON)" "1"
b17618c0 78OBJS += plugins/dfsound/arm_utils.o
79endif
de38f20e 80ifeq "$(USE_OSS)" "1"
81plugins/dfsound/%.o: CFLAGS += -DUSEOSS
82OBJS += plugins/dfsound/oss.o
83endif
84ifeq "$(USE_ALSA)" "1"
85plugins/dfsound/%.o: CFLAGS += -DUSEALSA
86OBJS += plugins/dfsound/alsa.o
87LDFLAGS += -lasound
88endif
89
e906c010 90# gpu
2ef486ee 91# note: code is not safe for strict-aliasing? (Castlevania problems)
ab948f7e 92plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing
a96a5eb2 93OBJS += plugins/dfxvideo/gpu.o
6d866bb7 94plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \
95 plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c
b60f2812 96ifdef X11
97LDFLAGS += -lX11 -lXv
98OBJS += plugins/dfxvideo/draw.o
99else
b60f2812 100OBJS += plugins/dfxvideo/draw_fb.o
101endif
e0c692d9 102
47bf65ab 103# cdrcimg
47bf65ab 104OBJS += plugins/cdrcimg/cdrcimg.o
e906c010 105
384f5f43 106# dfinput
4c08b9e7 107OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
384f5f43 108
80c2304e 109# gui
29a8c4f3 110OBJS += frontend/main.o frontend/plugin.o
76f7048e 111OBJS += frontend/plugin_lib.o frontend/common/readpng.o
112OBJS += frontend/common/fonts.o frontend/linux/plat.o
e0c692d9 113ifeq "$(USE_GTK)" "1"
114OBJS += maemo/hildon.o maemo/main.o
115maemo/%.o: maemo/%.c
116else
55b0eeea 117OBJS += frontend/menu.o frontend/linux/in_evdev.o
76f7048e 118OBJS += frontend/common/input.o frontend/linux/oshide.o
55b0eeea 119
120ifeq "$(PLATFORM)" "pandora"
121frontend/%.o: CFLAGS += -DVOUT_FBDEV
122OBJS += frontend/linux/fbdev.o
ccf51908 123OBJS += frontend/plat_omap.o
55b0eeea 124OBJS += frontend/plat_pandora.o
125else
126ifeq "$(PLATFORM)" "caanoo"
127OBJS += frontend/plat_pollux.o
128OBJS += frontend/warm/warm.o
ccf51908 129else
130OBJS += frontend/plat_dummy.o
a327967e 131endif
55b0eeea 132endif
133
e0c692d9 134endif # !USE_GTK
a80ae4a0 135
136ifeq "$(HAVE_NEON)" "1"
137OBJS += frontend/cspace_neon.o
138else
139OBJS += frontend/cspace.o
e0c692d9 140endif
447783f8 141ifdef X11
142frontend/%.o: CFLAGS += -DX11
143OBJS += frontend/xkb.o
144endif
72228559 145ifdef PCNT
146CFLAGS += -DPCNT
147endif
4c08b9e7 148ifndef NO_TSLIB
149frontend/%.o: CFLAGS += -DHAVE_TSLIB
150OBJS += frontend/pl_gun_ts.o
151endif
ab948f7e 152frontend/%.o: CFLAGS += -DIN_EVDEV
3c70c47b 153frontend/menu.o: frontend/revision.h
154
155frontend/revision.h: FORCE
156 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
157 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
158 @rm $@_
159.PHONY: FORCE
160
80c2304e 161
162$(TARGET): $(OBJS)
f95a77f7 163 $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
80c2304e 164
a80ae4a0 165PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
7ca0ce80 166 plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so
0d464c77 167
ee78346e 168$(PLUGINS):
169 make -C $(dir $@)
f932e54b 170
80c2304e 171clean:
ee78346e 172 $(RM) $(TARGET) $(OBJS) $(TARGET).map
173
174clean_plugins:
175 for dir in $(PLUGINS) ; do \
176 $(MAKE) -C $$(dirname $$dir) clean; done
80c2304e 177
303ee308 178# ----------- release -----------
179
180PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
181
45d45c1e 182VER ?= $(shell git describe master)
303ee308 183
ee78346e 184rel: pcsx $(PLUGINS) \
3938f69a 185 pandora/pcsx.sh pandora/pcsx.pxml.templ pandora/pcsx.png \
e3d0da26 186 pandora/picorestore pandora/readme.txt pandora/skin COPYING
303ee308 187 rm -rf out
bbd837c6 188 mkdir -p out/plugins
303ee308 189 cp -r $^ out/
3938f69a 190 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
191 rm out/pcsx.pxml.templ
bbd837c6 192 mv out/*.so out/plugins/
7ca0ce80 193 mv out/plugins/gpu_neon.so out/plugins/gpuPEOPS2.so
3938f69a 194 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i pandora/pcsx.png -c