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