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