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