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