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