4132e8ca |
1 | # Makefile for PCSX ReARMed |
a80ae4a0 |
2 | |
4132e8ca |
3 | TARGET = pcsx |
c5061935 |
4 | |
4132e8ca |
5 | # default CFLAGS go here, so that config can override them |
a80ae4a0 |
6 | CFLAGS += -Wall -ggdb -Ifrontend -ffast-math |
4132e8ca |
7 | LDLIBS += -lpthread -ldl -lpng -lz -lm |
f95a77f7 |
8 | ifndef DEBUG |
cfbd3c6e |
9 | CFLAGS += -O2 -DNDEBUG |
b60f2812 |
10 | endif |
4132e8ca |
11 | #DRC_DBG = 1 |
12 | #PCNT = 1 |
80c2304e |
13 | |
4132e8ca |
14 | all: config.mak $(TARGET) |
de38f20e |
15 | |
4132e8ca |
16 | ifneq ($(wildcard config.mak),) |
17 | config.mak: ./configure |
18 | @echo $@ is out-of-date, running configure |
19 | @sed -n "/.*Configured with/s/[^:]*: //p" $@ | sh |
20 | include config.mak |
21 | else |
22 | config.mak: |
23 | @echo "Please run ./configure before running make!" |
24 | @exit 1 |
25 | endif |
26 | -include Makefile.local |
80c2304e |
27 | |
28 | # core |
29 | OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \ |
3ebefe71 |
30 | libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \ |
80c2304e |
31 | libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \ |
32 | libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \ |
33 | libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \ |
34 | libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o |
59774ed0 |
35 | OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o |
36 | ifeq "$(ARCH)" "arm" |
37 | OBJS += libpcsxcore/gte_arm.o |
38 | endif |
a80ae4a0 |
39 | ifeq "$(HAVE_NEON)" "1" |
8cfbda97 |
40 | OBJS += libpcsxcore/gte_neon.o |
41 | endif |
ab948f7e |
42 | libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign |
43 | libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull |
44 | |
f95a77f7 |
45 | # dynarec |
4132e8ca |
46 | ifeq "$(USE_DYNAREC)" "1" |
7139f3c8 |
47 | OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o |
7e605697 |
48 | OBJS += libpcsxcore/new_dynarec/pcsxmem.o |
7139f3c8 |
49 | endif |
50 | OBJS += libpcsxcore/new_dynarec/emu_if.o |
b1be1eee |
51 | libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \ |
52 | libpcsxcore/new_dynarec/pcsxmem_inline.c |
ab948f7e |
53 | libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign |
3eb78778 |
54 | ifdef DRC_DBG |
55 | libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64 |
56 | CFLAGS += -DDRC_DBG |
57 | endif |
4132e8ca |
58 | ifeq "$(DRC_CACHE_BASE)" "1" |
59 | libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1 |
a327ad27 |
60 | endif |
f95a77f7 |
61 | |
e906c010 |
62 | # spu |
ee849648 |
63 | OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \ |
64 | plugins/dfsound/registers.o plugins/dfsound/spu.o |
6d866bb7 |
65 | plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \ |
66 | plugins/dfsound/xa.c |
3a721c1f |
67 | ifeq "$(ARCH)" "arm" |
b17618c0 |
68 | OBJS += plugins/dfsound/arm_utils.o |
69 | endif |
de38f20e |
70 | ifeq "$(USE_OSS)" "1" |
71 | plugins/dfsound/%.o: CFLAGS += -DUSEOSS |
72 | OBJS += plugins/dfsound/oss.o |
73 | endif |
74 | ifeq "$(USE_ALSA)" "1" |
75 | plugins/dfsound/%.o: CFLAGS += -DUSEALSA |
76 | OBJS += plugins/dfsound/alsa.o |
4132e8ca |
77 | LDLIBS += -lasound |
78 | endif |
79 | ifeq "$(USE_NO_SOUND)" "1" |
80 | OBJS += plugins/dfsound/nullsnd.o |
de38f20e |
81 | endif |
82 | |
e906c010 |
83 | # gpu |
62d7fa95 |
84 | OBJS += plugins/gpulib/gpu.o |
90ca4913 |
85 | ifeq "$(HAVE_NEON)" "1" |
62d7fa95 |
86 | OBJS += plugins/gpulib/cspace_neon.o |
90ca4913 |
87 | OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o |
88 | plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP |
89 | plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c |
90 | else |
62d7fa95 |
91 | OBJS += plugins/gpulib/cspace.o |
2ef486ee |
92 | # note: code is not safe for strict-aliasing? (Castlevania problems) |
62d7fa95 |
93 | plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing |
94 | plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c |
95 | OBJS += plugins/dfxvideo/gpulib_if.o |
90ca4913 |
96 | endif |
b60f2812 |
97 | ifdef X11 |
4132e8ca |
98 | LDLIBS += -lX11 `sdl-config --libs` |
62d7fa95 |
99 | OBJS += plugins/gpulib/vout_sdl.o |
100 | plugins/gpulib/vout_sdl.o: CFLAGS += `sdl-config --cflags` |
b60f2812 |
101 | else |
1f219c7b |
102 | OBJS += plugins/gpulib/vout_pl.o |
b60f2812 |
103 | endif |
e0c692d9 |
104 | |
47bf65ab |
105 | # cdrcimg |
47bf65ab |
106 | OBJS += plugins/cdrcimg/cdrcimg.o |
e906c010 |
107 | |
384f5f43 |
108 | # dfinput |
4c08b9e7 |
109 | OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o |
384f5f43 |
110 | |
80c2304e |
111 | # gui |
29a8c4f3 |
112 | OBJS += frontend/main.o frontend/plugin.o |
76f7048e |
113 | OBJS += frontend/plugin_lib.o frontend/common/readpng.o |
114 | OBJS += frontend/common/fonts.o frontend/linux/plat.o |
4132e8ca |
115 | ifeq "$(PLATFORM)" "maemo" |
e0c692d9 |
116 | OBJS += maemo/hildon.o maemo/main.o |
117 | maemo/%.o: maemo/%.c |
118 | else |
55b0eeea |
119 | OBJS += frontend/menu.o frontend/linux/in_evdev.o |
0b49a8f7 |
120 | OBJS += frontend/common/input.o frontend/linux/xenv.o |
55b0eeea |
121 | |
4132e8ca |
122 | ifeq "$(PLATFORM)" "generic" |
7badc935 |
123 | OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o |
4132e8ca |
124 | endif |
55b0eeea |
125 | ifeq "$(PLATFORM)" "pandora" |
55b0eeea |
126 | OBJS += frontend/linux/fbdev.o |
ccf51908 |
127 | OBJS += frontend/plat_omap.o |
55b0eeea |
128 | OBJS += frontend/plat_pandora.o |
4132e8ca |
129 | endif |
55b0eeea |
130 | ifeq "$(PLATFORM)" "caanoo" |
faf2b2aa |
131 | OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o |
221be40d |
132 | OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o |
55b0eeea |
133 | endif |
4132e8ca |
134 | endif # !maemo |
a80ae4a0 |
135 | |
447783f8 |
136 | ifdef X11 |
137 | frontend/%.o: CFLAGS += -DX11 |
138 | OBJS += frontend/xkb.o |
139 | endif |
72228559 |
140 | ifdef PCNT |
141 | CFLAGS += -DPCNT |
142 | endif |
4132e8ca |
143 | ifeq "$(HAVE_TSLIB)" "1" |
4c08b9e7 |
144 | frontend/%.o: CFLAGS += -DHAVE_TSLIB |
145 | OBJS += frontend/pl_gun_ts.o |
146 | endif |
ab948f7e |
147 | frontend/%.o: CFLAGS += -DIN_EVDEV |
7badc935 |
148 | frontend/menu.o frontend/plat_sdl.o: frontend/revision.h |
3c70c47b |
149 | |
59774ed0 |
150 | libpcsxcore/gte_nf.o: libpcsxcore/gte.c |
151 | $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS |
152 | |
3c70c47b |
153 | frontend/revision.h: FORCE |
154 | @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_ |
155 | @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@ |
156 | @rm $@_ |
157 | .PHONY: FORCE |
158 | |
90ca4913 |
159 | %.o: %.S |
160 | $(CC) $(CFLAGS) -c $^ -o $@ |
80c2304e |
161 | |
162 | $(TARGET): $(OBJS) |
4132e8ca |
163 | $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map |
80c2304e |
164 | |
4132e8ca |
165 | clean: $(PLAT_CLEAN) |
166 | $(RM) $(TARGET) $(OBJS) $(TARGET).map |
0d464c77 |
167 | |
4132e8ca |
168 | ifneq ($(PLUGINS),) |
ee78346e |
169 | $(PLUGINS): |
4fa24f17 |
170 | make -C plugins/gpulib/ clean |
ee78346e |
171 | make -C $(dir $@) |
f932e54b |
172 | |
ee78346e |
173 | clean_plugins: |
ea1f6f2f |
174 | make -C plugins/gpulib/ clean |
ee78346e |
175 | for dir in $(PLUGINS) ; do \ |
176 | $(MAKE) -C $$(dirname $$dir) clean; done |
4132e8ca |
177 | endif |
80c2304e |
178 | |
303ee308 |
179 | # ----------- release ----------- |
180 | |
4132e8ca |
181 | VER ?= $(shell git describe master) |
182 | |
183 | ifeq "$(PLATFORM)" "pandora" |
303ee308 |
184 | PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh |
185 | |
4132e8ca |
186 | PLUGINS ?= plugins/spunull/spunull.so plugins/gpu-gles/gpu_gles.so \ |
187 | plugins/gpu_unai/gpu_unai.so plugins/dfxvideo/gpu_peops.so |
303ee308 |
188 | |
ee78346e |
189 | rel: pcsx $(PLUGINS) \ |
9e0630ab |
190 | frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \ |
191 | frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING |
303ee308 |
192 | rm -rf out |
bbd837c6 |
193 | mkdir -p out/plugins |
303ee308 |
194 | cp -r $^ out/ |
3938f69a |
195 | sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml |
196 | rm out/pcsx.pxml.templ |
bbd837c6 |
197 | mv out/*.so out/plugins/ |
59f1c85c |
198 | mv out/plugins/gpu_unai.so out/plugins/gpuPCSX4ALL.so |
ea1f6f2f |
199 | mv out/plugins/gpu_gles.so out/plugins/gpuGLES.so |
59f1c85c |
200 | mv out/plugins/gpu_peops.so out/plugins/gpuPEOPS.so |
9e0630ab |
201 | $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c |
4132e8ca |
202 | endif |
203 | |
204 | ifeq "$(PLATFORM)" "caanoo" |
205 | PLAT_CLEAN = caanoo_clean |
206 | |
207 | caanoo_clean: |
208 | $(RM) frontend/320240/pollux_set |
209 | |
210 | PLUGINS ?= plugins/spunull/spunull.so plugins/gpu_unai/gpu_unai.so \ |
211 | plugins/gpu-gles/gpu_gles.so |
212 | |
213 | rel: pcsx $(PLUGINS) \ |
214 | frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \ |
215 | frontend/320240/pcsxb.png frontend/320240/skin \ |
216 | frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \ |
217 | frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \ |
218 | frontend/320240/haptic_s.cfg \ |
219 | readme.txt COPYING |
220 | rm -rf out |
221 | mkdir -p out/pcsx_rearmed/plugins |
222 | cp -r $^ out/pcsx_rearmed/ |
223 | mv out/pcsx_rearmed/gpu_unai.so out/pcsx_rearmed/gpuPCSX4ALL.so |
224 | mv out/pcsx_rearmed/gpu_gles.so out/pcsx_rearmed/gpuGLES.so |
225 | mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/ |
226 | mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe |
227 | mv out/pcsx_rearmed/pcsx_rearmed.ini out/ |
228 | mkdir out/pcsx_rearmed/lib/ |
229 | cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/ |
230 | mkdir out/pcsx_rearmed/bios/ |
231 | cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip * |
232 | endif |