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