b60f2812 |
1 | #CROSS_COMPILE= |
f95a77f7 |
2 | AS = $(CROSS_COMPILE)as |
80c2304e |
3 | CC = $(CROSS_COMPILE)gcc |
4 | LD = $(CROSS_COMPILE)ld |
5 | |
a80ae4a0 |
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 | |
c5061935 |
16 | ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}') |
17 | |
a80ae4a0 |
18 | CFLAGS += -Wall -ggdb -Ifrontend -ffast-math |
bb5cf0fc |
19 | LDFLAGS += -lz -lpthread -ldl -lpng |
f95a77f7 |
20 | ifndef DEBUG |
cfbd3c6e |
21 | CFLAGS += -O2 -DNDEBUG |
b60f2812 |
22 | endif |
e0c692d9 |
23 | CFLAGS += $(EXTRA_CFLAGS) |
24 | |
a80ae4a0 |
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 |
80c2304e |
35 | |
a80ae4a0 |
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) |
de38f20e |
39 | |
80c2304e |
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 |
a80ae4a0 |
49 | ifeq "$(HAVE_NEON)" "1" |
8cfbda97 |
50 | OBJS += libpcsxcore/gte_neon.o |
51 | endif |
ab948f7e |
52 | libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign |
53 | libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull |
54 | |
f95a77f7 |
55 | # dynarec |
7139f3c8 |
56 | ifndef NO_NEW_DRC |
a80ae4a0 |
57 | libpcsxcore/new_dynarec/linkage_arm.o: ASFLAGS += --defsym HAVE_ARMV7=$(HAVE_ARMV7) |
7139f3c8 |
58 | OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o |
7e605697 |
59 | OBJS += libpcsxcore/new_dynarec/pcsxmem.o |
7139f3c8 |
60 | endif |
61 | OBJS += libpcsxcore/new_dynarec/emu_if.o |
cbbab9cd |
62 | libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \ |
63 | libpcsxcore/new_dynarec/pcsxmem_inline.c |
ab948f7e |
64 | libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign |
3eb78778 |
65 | ifdef DRC_DBG |
66 | libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64 |
67 | CFLAGS += -DDRC_DBG |
68 | endif |
f95a77f7 |
69 | |
e906c010 |
70 | # spu |
ee849648 |
71 | OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \ |
72 | plugins/dfsound/registers.o plugins/dfsound/spu.o |
6d866bb7 |
73 | plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \ |
74 | plugins/dfsound/xa.c |
a80ae4a0 |
75 | ifeq "$(HAVE_NEON)" "1" |
b17618c0 |
76 | OBJS += plugins/dfsound/arm_utils.o |
77 | endif |
de38f20e |
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 | |
e906c010 |
88 | # gpu |
2ef486ee |
89 | # note: code is not safe for strict-aliasing? (Castlevania problems) |
ab948f7e |
90 | plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing |
a96a5eb2 |
91 | OBJS += plugins/dfxvideo/gpu.o |
6d866bb7 |
92 | plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \ |
93 | plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c |
b60f2812 |
94 | ifdef X11 |
95 | LDFLAGS += -lX11 -lXv |
96 | OBJS += plugins/dfxvideo/draw.o |
97 | else |
b60f2812 |
98 | OBJS += plugins/dfxvideo/draw_fb.o |
99 | endif |
e0c692d9 |
100 | |
47bf65ab |
101 | # cdrcimg |
47bf65ab |
102 | OBJS += plugins/cdrcimg/cdrcimg.o |
e906c010 |
103 | |
384f5f43 |
104 | # dfinput |
4c08b9e7 |
105 | OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o |
384f5f43 |
106 | |
80c2304e |
107 | # gui |
29a8c4f3 |
108 | OBJS += frontend/main.o frontend/plugin.o |
76f7048e |
109 | OBJS += frontend/plugin_lib.o frontend/common/readpng.o |
110 | OBJS += frontend/common/fonts.o frontend/linux/plat.o |
e0c692d9 |
111 | ifeq "$(USE_GTK)" "1" |
112 | OBJS += maemo/hildon.o maemo/main.o |
113 | maemo/%.o: maemo/%.c |
114 | else |
76f7048e |
115 | frontend/%.o: CFLAGS += -DVOUT_FBDEV |
116 | OBJS += frontend/menu.o |
69af03a2 |
117 | OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o |
76f7048e |
118 | OBJS += frontend/common/input.o frontend/linux/oshide.o |
c5061935 |
119 | ifeq "$(ARCH)" "arm" |
ccf51908 |
120 | OBJS += frontend/plat_omap.o |
799b0b87 |
121 | OBJS += frontend/pandora.o |
ccf51908 |
122 | else |
123 | OBJS += frontend/plat_dummy.o |
a327967e |
124 | endif |
e0c692d9 |
125 | endif # !USE_GTK |
a80ae4a0 |
126 | |
127 | ifeq "$(HAVE_NEON)" "1" |
128 | OBJS += frontend/cspace_neon.o |
129 | else |
130 | OBJS += frontend/cspace.o |
e0c692d9 |
131 | endif |
447783f8 |
132 | ifdef X11 |
133 | frontend/%.o: CFLAGS += -DX11 |
134 | OBJS += frontend/xkb.o |
135 | endif |
72228559 |
136 | ifdef PCNT |
137 | CFLAGS += -DPCNT |
138 | endif |
4c08b9e7 |
139 | ifndef NO_TSLIB |
140 | frontend/%.o: CFLAGS += -DHAVE_TSLIB |
141 | OBJS += frontend/pl_gun_ts.o |
142 | endif |
ab948f7e |
143 | frontend/%.o: CFLAGS += -DIN_EVDEV |
3c70c47b |
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 | |
80c2304e |
152 | |
153 | $(TARGET): $(OBJS) |
f95a77f7 |
154 | $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map |
80c2304e |
155 | |
a80ae4a0 |
156 | PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \ |
7ca0ce80 |
157 | plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so |
0d464c77 |
158 | |
ee78346e |
159 | $(PLUGINS): |
160 | make -C $(dir $@) |
f932e54b |
161 | |
80c2304e |
162 | clean: |
ee78346e |
163 | $(RM) $(TARGET) $(OBJS) $(TARGET).map |
164 | |
165 | clean_plugins: |
166 | for dir in $(PLUGINS) ; do \ |
167 | $(MAKE) -C $$(dirname $$dir) clean; done |
80c2304e |
168 | |
303ee308 |
169 | # ----------- release ----------- |
170 | |
171 | PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh |
172 | |
45d45c1e |
173 | VER ?= $(shell git describe master) |
303ee308 |
174 | |
ee78346e |
175 | rel: pcsx $(PLUGINS) \ |
3938f69a |
176 | pandora/pcsx.sh pandora/pcsx.pxml.templ pandora/pcsx.png \ |
e3d0da26 |
177 | pandora/picorestore pandora/readme.txt pandora/skin COPYING |
303ee308 |
178 | rm -rf out |
bbd837c6 |
179 | mkdir -p out/plugins |
303ee308 |
180 | cp -r $^ out/ |
3938f69a |
181 | sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml |
182 | rm out/pcsx.pxml.templ |
bbd837c6 |
183 | mv out/*.so out/plugins/ |
7ca0ce80 |
184 | mv out/plugins/gpu_neon.so out/plugins/gpuPEOPS2.so |
3938f69a |
185 | $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i pandora/pcsx.png -c |