cdrcimg: support .bz/.znx/eboot formats
[pcsx_rearmed.git] / Makefile
1 #CROSS_COMPILE=
2 AS = $(CROSS_COMPILE)as
3 CC = $(CROSS_COMPILE)gcc
4 LD = $(CROSS_COMPILE)ld
5
6 ARCH = $(shell $(CC) -v 2>&1 | grep -i 'target:' | awk '{print $$2}' | awk -F '-' '{print $$1}')
7
8 CFLAGS += -ggdb -Ifrontend
9 LDFLAGS += -lz -lpthread -ldl -lpng -lbz2
10 ifeq "$(ARCH)" "arm"
11 CFLAGS += -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp -ffast-math
12 ASFLAGS += -mcpu=cortex-a8 -mfpu=neon
13 endif
14 ifndef DEBUG
15 CFLAGS += -O2 -DNDEBUG
16 endif
17 USE_OSS = 1
18 #USE_ALSA = 1
19 #DRC_DBG = 1
20 #PCNT = 1
21 TARGET = pcsx
22
23 -include Makefile.local
24
25 all: $(TARGET)
26
27 # core
28 OBJS += libpcsxcore/cdriso.o libpcsxcore/cdrom.o libpcsxcore/cheat.o libpcsxcore/debug.o \
29         libpcsxcore/decode_xa.o libpcsxcore/disr3000a.o libpcsxcore/gte.o libpcsxcore/mdec.o \
30         libpcsxcore/misc.o libpcsxcore/plugins.o libpcsxcore/ppf.o libpcsxcore/psxbios.o \
31         libpcsxcore/psxcommon.o libpcsxcore/psxcounters.o libpcsxcore/psxdma.o libpcsxcore/psxhle.o \
32         libpcsxcore/psxhw.o libpcsxcore/psxinterpreter.o libpcsxcore/psxmem.o libpcsxcore/r3000a.o \
33         libpcsxcore/sio.o libpcsxcore/socket.o libpcsxcore/spu.o
34 # dynarec
35 ifndef NO_NEW_DRC
36 OBJS += libpcsxcore/new_dynarec/new_dynarec.o libpcsxcore/new_dynarec/linkage_arm.o
37 OBJS += libpcsxcore/new_dynarec/pcsxmem.o
38 endif
39 OBJS += libpcsxcore/new_dynarec/emu_if.o
40 libpcsxcore/new_dynarec/new_dynarec.o: libpcsxcore/new_dynarec/assem_arm.c
41 ifdef DRC_DBG
42 libpcsxcore/new_dynarec/emu_if.o: CFLAGS += -D_FILE_OFFSET_BITS=64
43 CFLAGS += -DDRC_DBG
44 endif
45
46 # spu
47 OBJS += plugins/dfsound/dma.o plugins/dfsound/freeze.o \
48         plugins/dfsound/registers.o plugins/dfsound/spu.o
49 ifeq "$(USE_OSS)" "1"
50 plugins/dfsound/%.o: CFLAGS += -DUSEOSS
51 OBJS += plugins/dfsound/oss.o
52 endif
53 ifeq "$(USE_ALSA)" "1"
54 plugins/dfsound/%.o: CFLAGS += -DUSEALSA
55 OBJS += plugins/dfsound/alsa.o
56 LDFLAGS += -lasound
57 endif
58
59 # gpu
60 plugins/dfxvideo/%.o: CFLAGS += -Wall
61 OBJS += plugins/dfxvideo/gpu.o
62 ifdef X11
63 LDFLAGS += -lX11 -lXv
64 OBJS += plugins/dfxvideo/draw.o
65 else
66 OBJS += plugins/dfxvideo/draw_fb.o
67 endif
68 # cdrcimg
69 plugins/cdrcimg/%.o: CFLAGS += -Wall
70 OBJS += plugins/cdrcimg/cdrcimg.o
71
72 # gui
73 OBJS += frontend/main.o frontend/plugin.o frontend/plugin_lib.o
74 OBJS += frontend/menu.o
75 OBJS += frontend/linux/fbdev.o frontend/linux/in_evdev.o
76 OBJS += frontend/linux/plat.o frontend/linux/oshide.o
77 OBJS += frontend/common/fonts.o frontend/common/input.o frontend/common/readpng.o
78 ifeq "$(ARCH)" "arm"
79 OBJS += frontend/arm_utils.o
80 OBJS += frontend/plat_omap.o
81 else
82 OBJS += frontend/plat_dummy.o
83 endif
84 ifdef X11
85 frontend/%.o: CFLAGS += -DX11
86 OBJS += frontend/xkb.o
87 endif
88 ifdef PCNT
89 CFLAGS += -DPCNT
90 endif
91 frontend/%.o: CFLAGS += -Wall -DIN_EVDEV
92 frontend/menu.o: frontend/revision.h
93
94 frontend/revision.h: FORCE
95         @(git describe || echo) | sed -e 's/.*/#define REV "\0"/' > $@_
96         @diff -q $@_ $@ > /dev/null 2>&1 || cp $@_ $@
97         @rm $@_
98 .PHONY: FORCE
99
100
101 $(TARGET): $(OBJS)
102         $(CC) -o $@ $^ $(LDFLAGS) -Wl,-Map=$@.map
103
104 PLUGINS = plugins/spunull/spunull.so plugins/gpu_unai/gpuPCSX4ALL.so \
105         plugins/gpu-gles/gpuGLES.so
106
107 $(PLUGINS):
108         make -C $(dir $@)
109
110 clean:
111         $(RM) $(TARGET) $(OBJS) $(TARGET).map
112
113 clean_plugins:
114         for dir in $(PLUGINS) ; do \
115                 $(MAKE) -C $$(dirname $$dir) clean; done
116
117 # ----------- release -----------
118
119 PND_MAKE ?= $(HOME)/dev/pnd/src/pandora-libraries/testdata/scripts/pnd_make.sh
120
121 VER ?= $(shell git describe --abbrev=0 master)
122
123 rel: pcsx $(PLUGINS) \
124                 pandora/pcsx.sh pandora/pcsx.pxml pandora/pcsx.png \
125                 pandora/picorestore pandora/readme.txt skin COPYING
126         rm -rf out
127         mkdir -p out/plugins
128         cp -r $^ out/
129         mv out/*.so out/plugins/
130         $(PND_MAKE) -p pcsx_rearmed_$(VER).pnd -d out -x pandora/pcsx.pxml -i pandora/pcsx.png -c