Don't compile in null sound driver for libretro and add
[pcsx_rearmed.git] / Makefile.libretro
CommitLineData
706252fc 1# Makefile for PCSX ReARMed (libretro)
2
3# default stuff goes here, so that config can override
4CFLAGS += -Wall -ggdb -Iinclude -ffast-math
5ifndef DEBUG
6CFLAGS += -O2 -DNDEBUG
7endif
8CXXFLAGS += $(CFLAGS)
9#DRC_DBG = 1
10#PCNT = 1
11
12all: target_ plugins_
13
14CC = gcc
15CXX = g++
16AS = as
17CFLAGS += -fPIC -Wno-unused-result
18ASFLAGS +=
19LDFLAGS +=
20LDLIBS += -lpthread
21MAIN_LDFLAGS += -shared -Wl,--no-undefined
22MAIN_LDLIBS += -ldl -lm -lz
23PLUGIN_CFLAGS += -fPIC
24
25TARGET = libretro.so
26PLATFORM = libretro
27BUILTIN_GPU = peops
28SOUND_DRIVERS = libretro
29PLUGINS = plugins/dfxvideo/gpu_peops.so plugins/gpu_unai/gpu_unai.so
30
31CC_LINK = $(CC)
32LDFLAGS += $(MAIN_LDFLAGS)
33LDLIBS += $(MAIN_LDLIBS)
34ifdef PCNT
35CFLAGS += -DPCNT
36endif
37
38# core
39OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
40 libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/mdec.o \
41 libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
42 libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
43 libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
44 libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
45OBJS += libpcsxcore/gte.o libpcsxcore/gte_nf.o libpcsxcore/gte_divider.o
46ifeq "$(ARCH)" "arm"
47OBJS += libpcsxcore/gte_arm.o
48endif
49ifeq "$(HAVE_NEON)" "1"
50OBJS += libpcsxcore/gte_neon.o
51endif
52libpcsxcore/psxbios.o: CFLAGS += -Wno-nonnull
53
54# dynarec
55ifeq "$(USE_DYNAREC)" "1"
56OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
57OBJS += libpcsxcore/new_dynarec/pcsxmem.o
58else
59libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -DDRC_DISABLE
60endif
61OBJS += libpcsxcore/new_dynarec/emu_if.o
62libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c \
63 libpcsxcore/new_dynarec/pcsxmem_inline.c
64libpcsxcore/new_dynarec/new_dynarec.o: CFLAGS += -Wno-all -Wno-pointer-sign
65ifdef DRC_DBG
66libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
67CFLAGS += -DDRC_DBG
68endif
69ifeq "$(DRC_CACHE_BASE)" "1"
70libpcsxcore/new_dynarec/%.o: CFLAGS += -DBASE_ADDR_FIXED=1
71endif
72
73# spu
74OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
75 plugins/dfsound/registers.o plugins/dfsound/spu.o \
76 plugins/dfsound/out.o
77plugins/dfsound/spu.o: plugins/dfsound/adsr.c plugins/dfsound/reverb.c \
78 plugins/dfsound/xa.c
79ifeq "$(ARCH)" "arm"
80OBJS += plugins/dfsound/arm_utils.o
81endif
82plugins/dfsound/out.o: CFLAGS += -DHAVE_LIBRETRO
83
84# builtin gpu
85OBJS += plugins/gpulib/gpu.o plugins/gpulib/vout_pl.o
86ifeq "$(BUILTIN_GPU)" "neon"
87OBJS += plugins/gpu_neon/psx_gpu_if.o plugins/gpu_neon/psx_gpu/psx_gpu_arm_neon.o
88plugins/gpu_neon/psx_gpu_if.o: CFLAGS += -DNEON_BUILD -DTEXTURE_CACHE_4BPP -DTEXTURE_CACHE_8BPP
89plugins/gpu_neon/psx_gpu_if.o: plugins/gpu_neon/psx_gpu/*.c
90endif
91ifeq "$(BUILTIN_GPU)" "peops"
92# note: code is not safe for strict-aliasing? (Castlevania problems)
93plugins/dfxvideo/gpulib_if.o: CFLAGS += -fno-strict-aliasing
94plugins/dfxvideo/gpulib_if.o: plugins/dfxvideo/prim.c plugins/dfxvideo/soft.c
95OBJS += plugins/dfxvideo/gpulib_if.o
96endif
97ifeq "$(BUILTIN_GPU)" "unai"
98OBJS += plugins/gpu_unai/gpulib_if.o
99ifeq "$(ARCH)" "arm"
100OBJS += plugins/gpu_unai/gpu_arm.o
101endif
102plugins/gpu_unai/gpulib_if.o: CFLAGS += -DREARMED -O3
103CC_LINK = $(CXX)
104endif
105
106# cdrcimg
107OBJS += plugins/cdrcimg/cdrcimg.o
108
109# dfinput
110OBJS += plugins/dfinput/main.o plugins/dfinput/pad.o plugins/dfinput/guncon.o
111
112# frontend/gui
113OBJS += frontend/cspace.o
114ifeq "$(HAVE_NEON)" "1"
115OBJS += frontend/cspace_neon.o
116else
117ifeq "$(ARCH)" "arm"
118OBJS += frontend/cspace_arm.o
119endif
120endif
121
122CFLAGS += -DFRONTEND_SUPPORTS_RGB565 -DNO_FRONTEND
123
124# misc
125OBJS += frontend/libretro.o frontend/main.o frontend/plugin.o
126
127
128frontend/menu.o frontend/main.o: frontend/revision.h
129frontend/libretro.o: frontend/revision.h
130
131libpcsxcore/gte_nf.o: libpcsxcore/gte.c
132 $(CC) -c -o $@ $^ $(CFLAGS) -DFLAGLESS
133
134frontend/revision.h: FORCE
135 @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
136 @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
137 @rm $@_
138
139%.o: %.S
140 $(CC) $(CFLAGS) -c $^ -o $@
141
142
143target_: $(TARGET)
144
145$(TARGET): $(OBJS)
146 $(CC_LINK) -o $@ $^ $(LDFLAGS) $(LDLIBS) -Wl,-Map=$@.map
147
148clean: $(PLAT_CLEAN) clean_plugins
149 $(RM) $(TARGET) $(OBJS) $(TARGET).map frontend/revision.h
150
151ifneq ($(PLUGINS),)
152plugins_: $(PLUGINS)
153
154$(PLUGINS):
155 make -C $(dir $@)
156
157clean_plugins:
158 make -C plugins/gpulib/ clean
159 for dir in $(PLUGINS) ; do \
160 $(MAKE) -C $$(dirname $$dir) clean; done
161else
162plugins_:
163clean_plugins:
164endif
165
166.PHONY: all clean target_ plugins_ clean_plugins FORCE