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