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