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