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