support armv5 build
[pcsx_rearmed.git] / Makefile
1 #CROSS_COMPILE=
2 AS = $(CROSS_COMPILE)as
3 CC = $(CROSS_COMPILE)gcc
4 LD = $(CROSS_COMPILE)ld
5
6 ARM926 ?= 0
7 ARM_CORTEXA8 ?= 1
8 USE_OSS ?= 1
9 #USE_ALSA = 1
10 #DRC_DBG = 1
11 #PCNT = 1
12 TARGET = pcsx
13
14 -include Makefile.local
15
16 ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
17
18 CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
19 LDFLAGS += -lz -lpthread -ldl -lpng -lbz2
20 ifndef DEBUG
21 CFLAGS += -O2 -DNDEBUG
22 endif
23 CFLAGS += $(EXTRA_CFLAGS)
24
25 ifeq "$(ARCH)" "arm"
26 ifeq "$(ARM_CORTEXA8)" "1"
27 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp
28 ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
29 endif
30 ifeq "$(ARM926)" "1"
31 CFLAGS += -mcpu=arm926ej-s -mtune=arm926ej-s
32 ASFLAGS += -mcpu=arm926ej-s
33 endif
34 endif
35
36 # detect armv7 and NEON from the specified CPU
37 HAVE_NEON = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_NEON__ 1' && echo 1)
38 HAVE_ARMV7 = $(shell $(CC) -E -dD $(CFLAGS) frontend/config.h | grep -q '__ARM_ARCH_7A__ 1' && echo 1)
39
40 all: $(TARGET)
41
42 # core
43 OBJS += 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
49 ifeq "$(HAVE_NEON)" "1"
50 OBJS += libpcsxcore/gte_neon.o
51 endif
52 libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
53 libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
54
55 # dynarec
56 ifndef NO_NEW_DRC
57 libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7)
58 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
59 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
60 endif
61 OBJS += libpcsxcore/new_dynarec/emu_if.o
62 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
63         libpcsxcore/new_dynarec/pcsxmem_inline.c
64 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
65 ifdef DRC_DBG
66 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
67 CFLAGS += -DDRC_DBG
68 endif
69
70 # spu
71 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
72         plugins/dfsound/registers.o plugins/dfsound/spu.o
73 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
74         plugins/dfsound/xa.c
75 ifeq "$(HAVE_NEON)" "1"
76 OBJS += plugins/dfsound/arm_utils.o
77 endif
78 ifeq "$(USE_OSS)" "1"
79 plugins/dfsound/%.o: CFLAGS += -DUSEOSS
80 OBJS += plugins/dfsound/oss.o
81 endif
82 ifeq "$(USE_ALSA)" "1"
83 plugins/dfsound/%.o: CFLAGS += -DUSEALSA
84 OBJS += plugins/dfsound/alsa.o
85 LDFLAGS += -lasound
86 endif
87
88 # gpu
89 # note: code is not safe for strict-aliasing? (Castlevania problems)
90 plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing
91 OBJS += plugins/dfxvideo/gpu.o
92 plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \
93         plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c
94 ifdef X11
95 LDFLAGS += -lX11 -lXv
96 OBJS += plugins/dfxvideo/draw.o
97 else
98 OBJS += plugins/dfxvideo/draw_fb.o
99 endif
100
101 # cdrcimg
102 OBJS += plugins/cdrcimg/cdrcimg.o
103
104 # dfinput
105 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
106
107 # gui
108 OBJS += frontend/main.o frontend/plugin.o
109 OBJS += frontend/plugin_lib.o frontend/common/readpng.o
110 OBJS += frontend/common/fonts.o frontend/linux/plat.o
111 ifeq "$(USE_GTK)" "1"
112 OBJS += maemo/hildon.o maemo/main.o
113 maemo/%.o: maemo/%.c
114 else
115 frontend/%.o: CFLAGS += -DVOUT_FBDEV
116 OBJS += frontend/menu.o
117 OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o
118 OBJS += frontend/common/input.o frontend/linux/oshide.o
119 ifeq "$(ARCH)" "arm"
120 OBJS += frontend/plat_omap.o
121 OBJS += frontend/pandora.o
122 else
123 OBJS += frontend/plat_dummy.o
124 endif
125 endif # !USE_GTK
126
127 ifeq "$(HAVE_NEON)" "1"
128 OBJS += frontend/cspace_neon.o
129 else
130 OBJS += frontend/cspace.o
131 endif
132 ifdef X11
133 frontend/%.o: CFLAGS += -DX11
134 OBJS += frontend/xkb.o
135 endif
136 ifdef PCNT
137 CFLAGS += -DPCNT
138 endif
139 ifndef NO_TSLIB
140 frontend/%.o: CFLAGS += -DHAVE_TSLIB
141 OBJS += frontend/pl_gun_ts.o
142 endif
143 frontend/%.o: CFLAGS += -DIN_EVDEV
144 frontend/menu.o: frontend/revision.h
145
146 frontend/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
156 PLUGINS ?= 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
162 clean:
163         $(RM) $(TARGET) $(OBJS) $(TARGET).map
164
165 clean_plugins:
166         for dir in $(PLUGINS) ; do \
167                 $(MAKE) -C $$(dirname $$dir) clean; done
168
169 # ----------- release -----------
170
171 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
172
173 VER ?= $(shell git describe master)
174
175 rel: 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