frontend: fix a couple of annoyancies
[pcsx_rearmed.git] / Makefile
1 #CROSS_COMPILE=
2 AS = $(CROSS_COMPILE)as
3 CC = $(CROSS_COMPILE)gcc
4 LD = $(CROSS_COMPILE)ld
5
6 ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
7
8 CFLAGS += -Wall -ggdb -Ifrontend
9 LDFLAGS += -lz -lpthread -ldl -lpng -lbz2
10 ifeq "$(ARCH)" "arm"
11 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
12 ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
13 endif
14 ifndef DEBUG
15 CFLAGS += -O2 -DNDEBUG
16 endif
17 CFLAGS += $(EXTRA_CFLAGS)
18
19 USE_OSS ?= 1
20 #USE_ALSA = 1
21 #DRC_DBG = 1
22 #PCNT = 1
23 TARGET = pcsx
24
25 -include Makefile.local
26
27 all: $(TARGET)
28
29 # core
30 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
31         libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/gte.o libpcsxcore/mdec.o \
32         libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
33         libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
34         libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
35         libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
36 ifeq "$(ARCH)" "arm"
37 OBJS += libpcsxcore/gte_neon.o
38 endif
39 libpcsxcore/cdrom.o libpcsxcore/misc.o: CFLAGS += -Wno-pointer-sign
40 libpcsxcore/misc.o libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
41
42 # dynarec
43 ifndef NO_NEW_DRC
44 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
45 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
46 endif
47 OBJS += libpcsxcore/new_dynarec/emu_if.o
48 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
49         libpcsxcore/new_dynarec/pcsxmem_inline.c
50 libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
51 ifdef DRC_DBG
52 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
53 CFLAGS += -DDRC_DBG
54 endif
55
56 # spu
57 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
58         plugins/dfsound/registers.o plugins/dfsound/spu.o
59 plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
60         plugins/dfsound/xa.c
61 ifeq "$(ARCH)" "arm"
62 OBJS += plugins/dfsound/arm_utils.o
63 endif
64 ifeq "$(USE_OSS)" "1"
65 plugins/dfsound/%.o: CFLAGS += -DUSEOSS
66 OBJS += plugins/dfsound/oss.o
67 endif
68 ifeq "$(USE_ALSA)" "1"
69 plugins/dfsound/%.o: CFLAGS += -DUSEALSA
70 OBJS += plugins/dfsound/alsa.o
71 LDFLAGS += -lasound
72 endif
73
74 # gpu
75 # note: code is not safe for strict-aliasing? (Castlevania problems)
76 plugins/dfxvideo/%.o: CFLAGS += -fno-strict-aliasing
77 OBJS += plugins/dfxvideo/gpu.o
78 plugins/dfxvideo/gpu.o: plugins/dfxvideo/fps.c plugins/dfxvideo/prim.c \
79         plugins/dfxvideo/gpu.c plugins/dfxvideo/soft.c
80 ifdef X11
81 LDFLAGS += -lX11 -lXv
82 OBJS += plugins/dfxvideo/draw.o
83 else
84 OBJS += plugins/dfxvideo/draw_fb.o
85 endif
86
87 # cdrcimg
88 OBJS += plugins/cdrcimg/cdrcimg.o
89
90 # dfinput
91 OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
92
93 # gui
94 OBJS += frontend/main.o frontend/plugin.o
95 OBJS += frontend/plugin_lib.o frontend/common/readpng.o
96 OBJS += frontend/common/fonts.o frontend/linux/plat.o
97 ifeq "$(USE_GTK)" "1"
98 OBJS += maemo/hildon.o maemo/main.o
99 maemo/%.o: maemo/%.c
100 else
101 frontend/%.o: CFLAGS += -DVOUT_FBDEV
102 OBJS += frontend/menu.o
103 OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o
104 OBJS += frontend/common/input.o frontend/linux/oshide.o
105 ifeq "$(ARCH)" "arm"
106 OBJS += frontend/plat_omap.o
107 OBJS += frontend/pandora.o
108 else
109 OBJS += frontend/plat_dummy.o
110 endif
111 endif # !USE_GTK
112 ifeq "$(ARCH)" "arm"
113 OBJS += frontend/arm_utils.o
114 endif
115 ifdef X11
116 frontend/%.o: CFLAGS += -DX11
117 OBJS += frontend/xkb.o
118 endif
119 ifdef PCNT
120 CFLAGS += -DPCNT
121 endif
122 ifndef NO_TSLIB
123 frontend/%.o: CFLAGS += -DHAVE_TSLIB
124 OBJS += frontend/pl_gun_ts.o
125 endif
126 frontend/%.o: CFLAGS += -DIN_EVDEV
127 frontend/menu.o: frontend/revision.h
128
129 frontend/revision.h: FORCE
130         @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
131         @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
132         @rm $@_
133 .PHONY: FORCE
134
135
136 $(TARGET): $(OBJS)
137         $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
138
139 PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
140         plugins/gpu-gles/gpuGLES.so plugins/gpu_neon/gpu_neon.so
141
142 $(PLUGINS):
143         make -C $(dir $@)
144
145 clean:
146         $(RM) $(TARGET) $(OBJS) $(TARGET).map
147
148 clean_plugins:
149         for dir in $(PLUGINS) ; do \
150                 $(MAKE) -C $$(dirname $$dir) clean; done
151
152 # ----------- release -----------
153
154 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
155
156 VER ?= $(shell git describe master)
157
158 rel: pcsx $(PLUGINS) \
159                 pandora/pcsx.sh pandora/pcsx.pxml.templ pandora/pcsx.png \
160                 pandora/picorestore pandora/readme.txt pandora/skin COPYING
161         rm -rf out
162         mkdir -p out/plugins
163         cp -r $^ out/
164         sed -e 's/%PR%/$(VER)/g' out/pcsx.pxml.templ > out/pcsx.pxml
165         rm out/pcsx.pxml.templ
166         mv out/*.so out/plugins/
167         mv out/plugins/gpu_neon.so out/plugins/gpuPEOPS2.so
168         $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x out/pcsx.pxml -i pandora/pcsx.png -c