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