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