32x: drc: more wip, some games work, debug stats
[libpicofe.git] / linux / Makefile
... / ...
CommitLineData
1# settings
2use_musashi = 1
3#use_fame = 1
4#use_mz80 = 1
5use_sh2drc = 1
6drc_debug = 1
7#profile = 1
8#fake_in_gp2x = 1
9
10-include Makefile.local
11
12ifeq "$(profile)" "1"
13CFLAGS += -O3 -Wall
14CFLAGS += -ftracer -fstrength-reduce -funroll-loops -fomit-frame-pointer -fstrict-aliasing -ffast-math
15CFLAGS += -fprofile-generate
16else
17CFLAGS += -ggdb -Wall -falign-functions=2
18endif
19DEFINES = _UNZIP_SUPPORT IO_STATS IN_EVDEV
20CFLAGS += -I../.. -I.
21LDFLAGS += -lX11 -lpthread
22
23# frontend
24OBJS += platform/gp2x/emu.o blit.o in_evdev.o plat.o sndout_oss.o gp2x.o log_io.o
25
26# common
27OBJS += platform/common/main.o platform/common/emu.o platform/common/menu.o \
28 platform/common/config.o platform/common/fonts.o platform/common/readpng.o \
29 platform/common/input.o
30
31ifeq "$(fake_in_gp2x)" "1"
32DEFINES += IN_GP2X FAKE_IN_GP2X
33OBJS += platform/gp2x/in_gp2x.o
34endif
35
36# Pico
37OBJS += pico/area.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o \
38 pico/videoport.o pico/draw2.o pico/draw.o pico/z80if.o pico/patch.o \
39 pico/mode4.o pico/sms.o pico/misc.o pico/eeprom.o pico/debug.o
40# Pico - CD
41OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \
42 pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \
43 pico/cd/area.o pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o
44# Pico - 32X
45OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o
46# Pico - Pico
47OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o
48# Pico - sound
49OBJS += pico/sound/sound.o pico/sound/sn76496.o pico/sound/ym2612.o pico/sound/mix.o
50# Pico - carthw
51OBJS += pico/carthw/carthw.o pico/carthw/svp/svp.o pico/carthw/svp/memory.o \
52 pico/carthw/svp/ssp16.o pico/carthw/svp/compiler.o
53# zlib
54OBJS += zlib/gzio.o zlib/inffast.o zlib/inflate.o zlib/inftrees.o zlib/trees.o \
55 zlib/deflate.o zlib/crc32.o zlib/adler32.o zlib/zutil.o zlib/compress.o zlib/uncompr.o
56# unzip
57OBJS += unzip/unzip.o unzip/unzip_stream.o
58# CPU cores
59ifeq "$(use_musashi)" "1"
60DEFINES += EMU_M68K
61OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o
62#OBJS += cpu/musashi/m68kdasm.o
63endif
64ifeq "$(use_fame)" "1"
65DEFINES += EMU_F68K
66OBJS += cpu/fame/famec.o
67endif
68# z80
69ifeq "$(use_mz80)" "1"
70DEFINES += _USE_MZ80
71OBJS += cpu/mz80/mz80.o
72else
73DEFINES += _USE_CZ80
74OBJS += cpu/cz80/cz80.o
75endif
76# sh2
77OBJS += cpu/sh2/sh2.o
78ifeq "$(use_sh2drc)" "1"
79DEFINES += DRC_SH2 DRC_TMP
80OBJS += cpu/sh2/mame/sh2pico.o
81OBJS += cpu/sh2/compiler.o
82OBJS += cpu/sh2/stub_x86.o
83ifeq "$(drc_debug)" "1"
84DEFINES += DRC_DEBUG=1
85OBJS += cpu/sh2/mame/sh2dasm.o
86OBJS += host_dasm.o
87LDFLAGS += -lbfd -lopcodes
88endif
89else
90OBJS += cpu/sh2/mame/sh2pico.o
91endif
92OBJS += cpu/drc/cmn.o
93# misc
94ifeq "$(use_fame)" "1"
95ifeq "$(use_musashi)" "1"
96OBJS += pico/debugCPU.o
97endif
98endif
99
100CFLAGS += $(addprefix -D,$(DEFINES))
101
102vpath %.c = ../..
103vpath %.asm = ../..
104
105DIRS = platform platform/gp2x platform/common pico pico/cd pico/pico pico/sound pico/carthw/svp \
106 pico/32x zlib unzip cpu cpu/musashi cpu/fame cpu/mz80 cpu/cz80 cpu/sh2/mame cpu/drc
107
108all: mkdirs PicoDrive
109clean: tidy
110 @$(RM) PicoDrive
111tidy:
112 $(RM) $(OBJS)
113 rm -rf $(DIRS)
114 @make -C ../../cpu/mz80/ clean
115
116PicoDrive : $(OBJS)
117 @echo ">>>" $@
118 $(CC) $(CFLAGS) $^ $(LDFLAGS) -lm -lpng -Wl,-Map=PicoDrive.map -o $@
119
120mkdirs:
121 @mkdir -p $(DIRS)
122
123include ../common/revision.mak
124
125pico/carthw/svp/compiler.o : ../../pico/carthw/svp/gen_arm.c
126pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h
127pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h
128
129../../cpu/musashi/m68kops.c :
130 @make -C ../../cpu/musashi
131
132cpu/mz80/mz80.o : ../../cpu/mz80/mz80.asm
133 @echo $@
134 @nasm -f elf $< -o $@
135
136../../cpu/mz80/mz80.asm :
137 @make -C ../../cpu/mz80/
138
139.c.o:
140 @echo ">>>" $<
141 $(CC) $(CFLAGS) -c $< -o $@
142.s.o:
143 @echo ">>>" $<
144 $(CC) $(CFLAGS) -c $< -o $@
145%.o : %.asm
146 @echo ">>>" $<
147 nasm -f elf $< -o $@
148
149
150cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h
151 @echo ">>>" $<
152 $(CC) $(CFLAGS) -Wno-unused -c $< -o $@
153