drc: fix PCSX HLE hack for armv5
[pcsx_rearmed.git] / Makefile
... / ...
CommitLineData
1#CROSS_COMPILE=
2AS = $(CROSS_COMPILE)as
3CC = $(CROSS_COMPILE)gcc
4LD = $(CROSS_COMPILE)ld
5
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
16ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
17
18CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
19LDFLAGS += -lz -lpthread -ldl -lpng
20ifndef DEBUG
21CFLAGS += -O2 -DNDEBUG
22endif
23CFLAGS += $(EXTRA_CFLAGS)
24
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
35
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)
39
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
49ifeq "$(HAVE_NEON)" "1"
50OBJS += libpcsxcore/gte_neon.o
51endif
52libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
53libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
54
55# dynarec
56ifndef NO_NEW_DRC
57libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7)
58OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
59OBJS += libpcsxcore/new_dynarec/pcsxmem.o
60endif
61OBJS += libpcsxcore/new_dynarec/emu_if.o
62libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
63 libpcsxcore/new_dynarec/pcsxmem_inline.c
64libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
65ifdef DRC_DBG
66libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
67CFLAGS += -DDRC_DBG
68endif
69
70# spu
71OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
72 plugins/dfsound/registers.o plugins/dfsound/spu.o
73plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
74 plugins/dfsound/xa.c
75ifeq "$(HAVE_NEON)" "1"
76OBJS += plugins/dfsound/arm_utils.o
77endif
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
88# gpu
89# note: code is not safe for strict-aliasing? (Castlevania problems)
90plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing
91OBJS += plugins/dfxvideo/gpu.o
92plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \
93 plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c
94ifdef X11
95LDFLAGS += -lX11 -lXv
96OBJS += plugins/dfxvideo/draw.o
97else
98OBJS += plugins/dfxvideo/draw_fb.o
99endif
100
101# cdrcimg
102OBJS += plugins/cdrcimg/cdrcimg.o
103
104# dfinput
105OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
106
107# gui
108OBJS += frontend/main.o frontend/plugin.o
109OBJS += frontend/plugin_lib.o frontend/common/readpng.o
110OBJS += frontend/common/fonts.o frontend/linux/plat.o
111ifeq "$(USE_GTK)" "1"
112OBJS += maemo/hildon.o maemo/main.o
113maemo/%.o: maemo/%.c
114else
115frontend/%.o: CFLAGS += -DVOUT_FBDEV
116OBJS += frontend/menu.o
117OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o
118OBJS += frontend/common/input.o frontend/linux/oshide.o
119ifeq "$(ARCH)" "arm"
120OBJS += frontend/plat_omap.o
121OBJS += frontend/pandora.o
122else
123OBJS += frontend/plat_dummy.o
124endif
125endif # !USE_GTK
126
127ifeq "$(HAVE_NEON)" "1"
128OBJS += frontend/cspace_neon.o
129else
130OBJS += frontend/cspace.o
131endif
132ifdef X11
133frontend/%.o: CFLAGS += -DX11
134OBJS += frontend/xkb.o
135endif
136ifdef PCNT
137CFLAGS += -DPCNT
138endif
139ifndef NO_TSLIB
140frontend/%.o: CFLAGS += -DHAVE_TSLIB
141OBJS += frontend/pl_gun_ts.o
142endif
143frontend/%.o: CFLAGS += -DIN_EVDEV
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
152
153$(TARGET): $(OBJS)
154 $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
155
156PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
157 plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so
158
159$(PLUGINS):
160 make -C $(dir $@)
161
162clean:
163 $(RM) $(TARGET) $(OBJS) $(TARGET).map
164
165clean_plugins:
166 for dir in $(PLUGINS) ; do \
167 $(MAKE) -C $$(dirname $$dir) clean; done
168
169# ----------- release -----------
170
171PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
172
173VER ?= $(shell git describe master)
174
175rel: pcsx $(PLUGINS) \
176 pandora/pcsx.sh pandora/pcsx.pxml.templ pandora/pcsx.png \
177 pandora/picorestore pandora/readme.txt pandora/skin COPYING
178 rm -rf out
179 mkdir -p out/plugins
180 cp -r $^ out/
181 sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
182 rm out/pcsx.pxml.templ
183 mv out/*.so out/plugins/
184 mv out/plugins/gpu_neon.so out/plugins/gpuPEOPS2.so
185 $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i pandora/pcsx.png -c