frontend: support seeking the filelist with letter keys
[pcsx_rearmed.git] / Makefile
1 # Makefile for PCSX ReARMed
2
3 TARGET = pcsx
4
5 # default CFLAGS go here, so that config can override them
6 CFLAGS += -Wall -ggdb -Ifrontend -ffast-math
7 LDLIBS += -lpthread -ldl -lpng -lz -lm
8 ifndef DEBUG
9 CFLAGS += -O2 -DNDEBUG
10 endif
11 #DRC_DBG = 1
12 #PCNT = 1
13
14 all: config.mak $(TARGET) plugins_
15
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
27
28 # core
29 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
30         libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
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
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
39 ifeq "$(HAVE_NEON)" "1"
40 OBJS += libpcsxcore/gte_neon.o
41 endif
42 libpcsxcore/gte.o libpcsxcore/gte_nf.o: CFLAGS += -fno-strict-aliasing
43 libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
44 libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
45
46 # dynarec
47 ifeq "$(USE_DYNAREC)" "1"
48 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
49 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
50 endif
51 OBJS += libpcsxcore/new_dynarec/emu_if.o
52 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
53         libpcsxcore/new_dynarec/pcsxmem_inline.c
54 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
55 ifdef DRC_DBG
56 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
57 CFLAGS += -DDRC_DBG
58 endif
59 ifeq "$(DRC_CACHE_BASE)" "1"
60 libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
61 endif
62
63 # spu
64 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
65         plugins/dfsound/registers.o plugins/dfsound/spu.o
66 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
67         plugins/dfsound/xa.c
68 ifeq "$(ARCH)" "arm"
69 OBJS += plugins/dfsound/arm_utils.o
70 endif
71 ifeq "$(USE_OSS)" "1"
72 plugins/dfsound/%.o: CFLAGS += -DUSEOSS
73 OBJS += plugins/dfsound/oss.o
74 endif
75 ifeq "$(USE_ALSA)" "1"
76 plugins/dfsound/%.o: CFLAGS += -DUSEALSA
77 OBJS += plugins/dfsound/alsa.o
78 LDLIBS += -lasound
79 endif
80 ifeq "$(USE_NO_SOUND)" "1"
81 OBJS += plugins/dfsound/nullsnd.o
82 endif
83
84 # gpu
85 OBJS += plugins/gpulib/gpu.o
86 ifeq "$(HAVE_NEON)" "1"
87 OBJS += plugins/gpulib/cspace_neon.o
88 OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
89 plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
90 plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
91 else
92 OBJS += plugins/gpulib/cspace.o
93 # note: code is not safe for strict-aliasing? (Castlevania problems)
94 plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
95 plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
96 OBJS += plugins/dfxvideo/gpulib_if.o
97 endif
98 ifdef X11
99 LDLIBS += -lX11 `sdl-config --libs`
100 OBJS += plugins/gpulib/vout_sdl.o
101 plugins/gpulib/vout_sdl.o: CFLAGS += `sdl-config --cflags`
102 else
103 OBJS += plugins/gpulib/vout_pl.o
104 endif
105
106 # cdrcimg
107 OBJS += plugins/cdrcimg/cdrcimg.o
108
109 # dfinput
110 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
111
112 # gui
113 OBJS += frontend/main.o frontend/plugin.o
114 OBJS += frontend/plugin_lib.o frontend/common/readpng.o
115 OBJS += frontend/common/fonts.o frontend/linux/plat.o
116 ifeq "$(PLATFORM)" "maemo"
117 OBJS += maemo/hildon.o maemo/main.o
118 maemo/%.o: maemo/%.c
119 else
120 OBJS += frontend/menu.o frontend/linux/in_evdev.o
121 OBJS += frontend/common/input.o
122
123 ifeq "$(PLATFORM)" "generic"
124 OBJS += frontend/plat_sdl.o frontend/common/in_sdl.o
125 endif
126 ifeq "$(PLATFORM)" "pandora"
127 OBJS += frontend/linux/fbdev.o
128 OBJS += frontend/plat_omap.o frontend/linux/xenv.o
129 OBJS += frontend/plat_pandora.o
130 endif
131 ifeq "$(PLATFORM)" "caanoo"
132 OBJS += frontend/plat_pollux.o frontend/in_tsbutton.o frontend/blit320.o
133 OBJS += frontend/gp2x/in_gp2x.o frontend/warm/warm.o
134 endif
135 endif # !maemo
136
137 ifdef X11
138 frontend/%.o: CFLAGS += -DX11
139 OBJS += frontend/xkb.o
140 endif
141 ifdef PCNT
142 CFLAGS += -DPCNT
143 endif
144 ifeq "$(HAVE_TSLIB)" "1"
145 frontend/%.o: CFLAGS += -DHAVE_TSLIB
146 OBJS += frontend/pl_gun_ts.o
147 endif
148 frontend/%.o: CFLAGS += -DIN_EVDEV
149 frontend/menu.o frontend/plat_sdl.o: frontend/revision.h
150
151 libpcsxcore/gte_nf.o: libpcsxcore/gte.c
152         $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
153
154 frontend/revision.h: FORCE
155         @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
156         @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
157         @rm $@_
158 .PHONY: FORCE
159
160 %.o: %.S
161         $(CC) $(CFLAGS) -c $^ -o $@
162
163 $(TARGET): $(OBJS)
164         $(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
165
166 clean: $(PLAT_CLEAN) clean_plugins
167         $(RM) $(TARGET) $(OBJS) $(TARGET).map
168
169 ifneq ($(PLUGINS),)
170 plugins_: $(PLUGINS)
171
172 $(PLUGINS):
173         make -C $(dir $@)
174
175 clean_plugins:
176         make -C plugins/gpulib/ clean
177         for dir in $(PLUGINS) ; do \
178                 $(MAKE) -C $$(dirname $$dir) clean; done
179 else
180 plugins_:
181 clean_plugins:
182 endif
183
184 # ----------- release -----------
185
186 VER ?= $(shell git describe master)
187
188 ifeq "$(PLATFORM)" "generic"
189 OUT = pcsx_rearmed_$(VER)
190
191 rel: pcsx $(PLUGINS) \
192                 frontend/pandora/skin readme.txt COPYING
193         rm -rf $(OUT)
194         mkdir -p $(OUT)/plugins
195         mkdir -p $(OUT)/bios
196         cp -r $^ $(OUT)/
197         mv $(OUT)/*.so* $(OUT)/plugins/
198         zip -9 -r $(OUT).zip $(OUT)
199 endif
200
201 ifeq "$(PLATFORM)" "pandora"
202 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
203
204 rel: pcsx $(PLUGINS) \
205                 frontend/pandora/pcsx.sh frontend/pandora/pcsx.pxml.templ frontend/pandora/pcsx.png \
206                 frontend/pandora/picorestore frontend/pandora/skin readme.txt COPYING
207         rm -rf out
208         mkdir -p out/plugins
209         cp -r $^ out/
210         sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
211         rm out/pcsx.pxml.templ
212         mv out/*.so out/plugins/
213         mv out/plugins/gpu_unai.so out/plugins/gpuPCSX4ALL.so
214         mv out/plugins/gpu_gles.so out/plugins/gpuGLES.so
215         mv out/plugins/gpu_peops.so out/plugins/gpuPEOPS.so
216         $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i frontend/pandora/pcsx.png -c
217 endif
218
219 ifeq "$(PLATFORM)" "caanoo"
220 PLAT_CLEAN = caanoo_clean
221
222 caanoo_clean:
223         $(RM) frontend/320240/pollux_set
224
225 rel: pcsx $(PLUGINS) \
226                 frontend/320240/caanoo.gpe frontend/320240/pcsx26.png \
227                 frontend/320240/pcsxb.png frontend/320240/skin \
228                 frontend/warm/bin/warm_2.6.24.ko frontend/320240/pollux_set \
229                 frontend/320240/pcsx_rearmed.ini frontend/320240/haptic_w.cfg \
230                 frontend/320240/haptic_s.cfg \
231                 readme.txt COPYING
232         rm -rf out
233         mkdir -p out/pcsx_rearmed/plugins
234         cp -r $^ out/pcsx_rearmed/
235         mv out/pcsx_rearmed/gpu_unai.so out/pcsx_rearmed/gpuPCSX4ALL.so
236         mv out/pcsx_rearmed/gpu_gles.so out/pcsx_rearmed/gpuGLES.so
237         mv out/pcsx_rearmed/*.so out/pcsx_rearmed/plugins/
238         mv out/pcsx_rearmed/caanoo.gpe out/pcsx_rearmed/pcsx.gpe
239         mv out/pcsx_rearmed/pcsx_rearmed.ini out/
240         mkdir out/pcsx_rearmed/lib/
241         cp ./lib/libbz2.so.1 out/pcsx_rearmed/lib/
242         mkdir out/pcsx_rearmed/bios/
243         cd out && zip -9 -r ../pcsx_rearmed_$(VER)_caanoo.zip *
244 endif