cd: fix cycle overflow issue
[picodrive.git] / platform / common / common.mak
CommitLineData
00faec9c 1ifdef drc_debug
2use_fame = 1
3use_cz80 = 1
4use_cyclone = 0
5use_drz80 = 0
6
7asm_memory = 0
8asm_render = 0
9asm_ym2612 = 0
10asm_misc = 0
11asm_cdpico = 0
12asm_cdmemory = 0
13asm_mix = 0
14endif
15
697746df 16ifeq "$(profile)" "1"
17CFLAGS += -fprofile-generate
18endif
19ifeq "$(profile)" "2"
20CFLAGS += -fprofile-use
21endif
5686d931 22ifeq "$(pdb)" "1"
23DEFINES += PDB
98dbc3ab 24SRCS_COMMON += $(R)cpu/debug.c
5686d931 25 ifeq "$(pdb_net)" "1"
26 DEFINES += PDB_NET
27 endif
28 ifeq "$(readline)" "1"
29 DEFINES += HAVE_READLINE
30 LDFLAGS += -lreadline
31 endif
32endif
12da51c2 33ifeq "$(cpu_cmp)" "1"
34ifdef cpu_cmp_w
35DEFINES += CPU_CMP_W
36else
37DEFINES += CPU_CMP_R
38endif # cpu_cmp_w
39endif
f6c49d38 40ifeq "$(pprof)" "1"
41DEFINES += PPROF
98dbc3ab 42SRCS_COMMON += $(R)platform/linux/pprof.c
f6c49d38 43endif
697746df 44
0a91c6e9 45# ARM asm stuff
46ifeq "$(ARCH)" "arm"
d4d62665 47ifeq "$(asm_render)" "1"
48DEFINES += _ASM_DRAW_C
98dbc3ab 49SRCS_COMMON += $(R)pico/draw_arm.S $(R)pico/draw2_arm.S
d4d62665 50endif
51ifeq "$(asm_memory)" "1"
52DEFINES += _ASM_MEMORY_C
98dbc3ab 53SRCS_COMMON += $(R)pico/memory_arm.s
d4d62665 54endif
55ifeq "$(asm_ym2612)" "1"
56DEFINES += _ASM_YM2612_C
98dbc3ab 57SRCS_COMMON += $(R)pico/sound/ym2612_arm.s
d4d62665 58endif
59ifeq "$(asm_misc)" "1"
60DEFINES += _ASM_MISC_C
98dbc3ab 61SRCS_COMMON += $(R)pico/misc_arm.s
62SRCS_COMMON += $(R)pico/cd/misc_arm.s
d4d62665 63endif
64ifeq "$(asm_cdpico)" "1"
65DEFINES += _ASM_CD_PICO_C
89dbbf2b 66SRCS_COMMON += $(R)pico/cd/mcd_arm.s
d4d62665 67endif
68ifeq "$(asm_cdmemory)" "1"
69DEFINES += _ASM_CD_MEMORY_C
98dbc3ab 70SRCS_COMMON += $(R)pico/cd/memory_arm.s
d4d62665 71endif
72ifeq "$(asm_32xdraw)" "1"
73DEFINES += _ASM_32X_DRAW
98dbc3ab 74SRCS_COMMON += $(R)pico/32x/draw_arm.s
d4d62665 75endif
0a91c6e9 76ifeq "$(asm_mix)" "1"
77SRCS_COMMON += $(R)pico/sound/mix_arm.s
78endif
79endif # ARCH=arm
d4d62665 80
697746df 81# === Pico core ===
82# Pico
98dbc3ab 83SRCS_COMMON += $(R)pico/pico.c $(R)pico/cart.c $(R)pico/memory.c \
84 $(R)pico/state.c $(R)pico/sek.c $(R)pico/z80if.c \
85 $(R)pico/videoport.c $(R)pico/draw2.c $(R)pico/draw.c \
86 $(R)pico/mode4.c $(R)pico/misc.c $(R)pico/eeprom.c \
87 $(R)pico/patch.c $(R)pico/debug.c $(R)pico/media.c
f3a57b2d 88# SMS
89ifneq "$(no_sms)" "1"
98dbc3ab 90SRCS_COMMON += $(R)pico/sms.c
f3a57b2d 91else
92DEFINES += NO_SMS
93endif
697746df 94# CD
89dbbf2b 95SRCS_COMMON += $(R)pico/cd/mcd.c $(R)pico/cd/memory.c $(R)pico/cd/sek.c \
98dbc3ab 96 $(R)pico/cd/LC89510.c $(R)pico/cd/cd_sys.c $(R)pico/cd/cd_file.c \
a93a80de 97 $(R)pico/cd/cue.c $(R)pico/cd/gfx.c $(R)pico/cd/gfx_dma.c \
98 $(R)pico/cd/misc.c $(R)pico/cd/pcm.c $(R)pico/cd/buffering.c
697746df 99# 32X
f3a57b2d 100ifneq "$(no_32x)" "1"
98dbc3ab 101SRCS_COMMON += $(R)pico/32x/32x.c $(R)pico/32x/memory.c $(R)pico/32x/draw.c \
045a4c52 102 $(R)pico/32x/sh2soc.c $(R)pico/32x/pwm.c
f3a57b2d 103else
104DEFINES += NO_32X
105endif
697746df 106# Pico
98dbc3ab 107SRCS_COMMON += $(R)pico/pico/pico.c $(R)pico/pico/memory.c $(R)pico/pico/xpcm.c
697746df 108# carthw
98dbc3ab 109SRCS_COMMON += $(R)pico/carthw/carthw.c
697746df 110# SVP
98dbc3ab 111SRCS_COMMON += $(R)pico/carthw/svp/svp.c $(R)pico/carthw/svp/memory.c \
112 $(R)pico/carthw/svp/ssp16.c
0a91c6e9 113ifeq "$(use_svpdrc)" "1"
7fd5d17b 114DEFINES += _SVP_DRC
98dbc3ab 115SRCS_COMMON += $(R)pico/carthw/svp/stub_arm.S
116SRCS_COMMON += $(R)pico/carthw/svp/compiler.c
d4d62665 117endif
697746df 118# sound
98dbc3ab 119SRCS_COMMON += $(R)pico/sound/sound.c
120SRCS_COMMON += $(R)pico/sound/sn76496.c $(R)pico/sound/ym2612.c
0a91c6e9 121ifneq "$(ARCH)$(asm_mix)" "arm1"
98dbc3ab 122SRCS_COMMON += $(R)pico/sound/mix.c
4c2e3554 123endif
697746df 124
f0d7b1fa 125# === CPU cores ===
126# --- M68k ---
127ifeq "$(use_musashi)" "1"
128DEFINES += EMU_M68K
98dbc3ab 129SRCS_COMMON += $(R)cpu/musashi/m68kops.c $(R)cpu/musashi/m68kcpu.c
130#SRCS_COMMON += $(R)cpu/musashi/m68kdasm.c
f0d7b1fa 131endif
132ifeq "$(use_cyclone)" "1"
133DEFINES += EMU_C68K
98dbc3ab 134SRCS_COMMON += $(R)pico/m68kif_cyclone.s $(R)cpu/cyclone/Cyclone.s \
135 $(R)cpu/cyclone/tools/idle.s
f0d7b1fa 136endif
137ifeq "$(use_fame)" "1"
138DEFINES += EMU_F68K
98dbc3ab 139SRCS_COMMON += $(R)cpu/fame/famec.c
f0d7b1fa 140endif
141
142# --- Z80 ---
f0d7b1fa 143ifeq "$(use_drz80)" "1"
144DEFINES += _USE_DRZ80
98dbc3ab 145SRCS_COMMON += $(R)cpu/DrZ80/drz80.s
f0d7b1fa 146endif
147#
148ifeq "$(use_cz80)" "1"
149DEFINES += _USE_CZ80
98dbc3ab 150SRCS_COMMON += $(R)cpu/cz80/cz80.c
f0d7b1fa 151endif
152
153# --- SH2 ---
98dbc3ab 154SRCS_COMMON += $(R)cpu/drc/cmn.c
f3a57b2d 155ifneq "$(no_32x)" "1"
98dbc3ab 156SRCS_COMMON += $(R)cpu/sh2/sh2.c
f0d7b1fa 157#
158ifeq "$(use_sh2drc)" "1"
159DEFINES += DRC_SH2
98dbc3ab 160SRCS_COMMON += $(R)cpu/sh2/compiler.c
f0d7b1fa 161ifdef drc_debug
162DEFINES += DRC_DEBUG=$(drc_debug)
98dbc3ab 163SRCS_COMMON += $(R)cpu/sh2/mame/sh2dasm.c
009ef50c 164SRCS_COMMON += $(R)platform/libpicofe/linux/host_dasm.c
f0d7b1fa 165LDFLAGS += -lbfd -lopcodes -liberty
166endif
f3a57b2d 167endif # use_sh2drc
98dbc3ab 168SRCS_COMMON += $(R)cpu/sh2/mame/sh2pico.c
f3a57b2d 169endif # !no_32x
f0d7b1fa 170
98dbc3ab 171OBJS_COMMON := $(SRCS_COMMON:.c=.o)
172OBJS_COMMON := $(OBJS_COMMON:.s=.o)
173OBJS_COMMON := $(OBJS_COMMON:.S=.o)
697746df 174
98dbc3ab 175ifneq ($(deps_set),yes)
176ifeq "$(use_cyclone)" "1"
177$(FR)pico/pico.c: $(FR)cpu/cyclone/Cyclone.h
178endif
f0d7b1fa 179
98dbc3ab 180$(FR)cpu/cyclone/Cyclone.h:
181 @echo "Cyclone submodule is missing, please run 'git submodule update --init'"
182 @false
f0d7b1fa 183
89dbbf2b 184$(FR)cpu/cyclone/Cyclone.s: $(FR)cpu/cyclone_config.h
f0d7b1fa 185 @echo building Cyclone...
12da51c2 186 @make -C $(R)cpu/cyclone/ CONFIG_FILE=../cyclone_config.h
98dbc3ab 187
89dbbf2b 188$(FR)cpu/cyclone/Cyclone.s: $(FR)cpu/cyclone/*.cpp $(FR)cpu/cyclone/*.h
189
98dbc3ab 190$(FR)cpu/musashi/m68kops.c:
191 @make -C $(R)cpu/musashi
f0d7b1fa 192
98dbc3ab 193deps_set = yes
194endif # deps_set