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