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