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