| 1 | ifneq ($(DEBUG),) |
| 2 | CFLAGS += -ggdb |
| 3 | endif |
| 4 | ifeq "$(profile)" "1" |
| 5 | CFLAGS += -fprofile-generate |
| 6 | endif |
| 7 | ifeq "$(profile)" "2" |
| 8 | CFLAGS += -fprofile-use |
| 9 | endif |
| 10 | ifeq "$(pdb)" "1" |
| 11 | DEFINES += PDB |
| 12 | OBJS += cpu/debug.o |
| 13 | ifeq "$(pdb_net)" "1" |
| 14 | DEFINES += PDB_NET |
| 15 | endif |
| 16 | ifeq "$(readline)" "1" |
| 17 | DEFINES += HAVE_READLINE |
| 18 | LDFLAGS += -lreadline |
| 19 | endif |
| 20 | endif |
| 21 | ifeq "$(pprof)" "1" |
| 22 | DEFINES += PPROF |
| 23 | OBJS += platform/linux/pprof.o |
| 24 | endif |
| 25 | |
| 26 | # === Pico core === |
| 27 | # Pico |
| 28 | OBJS += pico/state.o pico/cart.o pico/memory.o pico/pico.o pico/sek.o pico/z80if.o \ |
| 29 | pico/videoport.o pico/draw2.o pico/draw.o pico/mode4.o \ |
| 30 | pico/misc.o pico/eeprom.o pico/patch.o pico/debug.o |
| 31 | # SMS |
| 32 | ifneq "$(no_sms)" "1" |
| 33 | OBJS += pico/sms.o |
| 34 | else |
| 35 | DEFINES += NO_SMS |
| 36 | endif |
| 37 | # CD |
| 38 | OBJS += pico/cd/pico.o pico/cd/memory.o pico/cd/sek.o pico/cd/LC89510.o \ |
| 39 | pico/cd/cd_sys.o pico/cd/cd_file.o pico/cd/cue.o pico/cd/gfx_cd.o \ |
| 40 | pico/cd/misc.o pico/cd/pcm.o pico/cd/buffering.o |
| 41 | # 32X |
| 42 | ifneq "$(no_32x)" "1" |
| 43 | OBJS += pico/32x/32x.o pico/32x/memory.o pico/32x/draw.o pico/32x/pwm.o |
| 44 | else |
| 45 | DEFINES += NO_32X |
| 46 | endif |
| 47 | # Pico |
| 48 | OBJS += pico/pico/pico.o pico/pico/memory.o pico/pico/xpcm.o |
| 49 | # carthw |
| 50 | OBJS += pico/carthw/carthw.o |
| 51 | # SVP |
| 52 | OBJS += pico/carthw/svp/svp.o pico/carthw/svp/memory.o \ |
| 53 | pico/carthw/svp/ssp16.o |
| 54 | # sound |
| 55 | OBJS += pico/sound/sound.o |
| 56 | OBJS += pico/sound/sn76496.o pico/sound/ym2612.o |
| 57 | |
| 58 | # === CPU cores === |
| 59 | # --- M68k --- |
| 60 | ifeq "$(use_musashi)" "1" |
| 61 | DEFINES += EMU_M68K |
| 62 | OBJS += cpu/musashi/m68kops.o cpu/musashi/m68kcpu.o |
| 63 | #OBJS += cpu/musashi/m68kdasm.o |
| 64 | endif |
| 65 | ifeq "$(use_cyclone)" "1" |
| 66 | DEFINES += EMU_C68K |
| 67 | OBJS += pico/m68kif_cyclone.o cpu/Cyclone/proj/Cyclone.o cpu/Cyclone/tools/idle.o |
| 68 | endif |
| 69 | ifeq "$(use_fame)" "1" |
| 70 | DEFINES += EMU_F68K |
| 71 | OBJS += cpu/fame/famec.o |
| 72 | endif |
| 73 | |
| 74 | # --- Z80 --- |
| 75 | ifeq "$(use_drz80)" "1" |
| 76 | DEFINES += _USE_DRZ80 |
| 77 | OBJS += cpu/DrZ80/drz80.o |
| 78 | endif |
| 79 | # |
| 80 | ifeq "$(use_cz80)" "1" |
| 81 | DEFINES += _USE_CZ80 |
| 82 | OBJS += cpu/cz80/cz80.o |
| 83 | endif |
| 84 | |
| 85 | # --- SH2 --- |
| 86 | OBJS += cpu/drc/cmn.o |
| 87 | ifneq "$(no_32x)" "1" |
| 88 | OBJS += cpu/sh2/sh2.o |
| 89 | # |
| 90 | ifeq "$(use_sh2drc)" "1" |
| 91 | DEFINES += DRC_SH2 |
| 92 | OBJS += cpu/sh2/compiler.o |
| 93 | ifdef drc_debug |
| 94 | DEFINES += DRC_DEBUG=$(drc_debug) |
| 95 | OBJS += cpu/sh2/mame/sh2dasm.o |
| 96 | OBJS += platform/linux/host_dasm.o |
| 97 | LDFLAGS += -lbfd -lopcodes -liberty |
| 98 | endif |
| 99 | ifeq "$(drc_debug_interp)" "1" |
| 100 | DEFINES += DRC_DEBUG_INTERP |
| 101 | use_sh2mame = 1 |
| 102 | endif |
| 103 | endif # use_sh2drc |
| 104 | # |
| 105 | ifeq "$(use_sh2mame)" "1" |
| 106 | OBJS += cpu/sh2/mame/sh2pico.o |
| 107 | endif |
| 108 | endif # !no_32x |
| 109 | |
| 110 | |
| 111 | DIRS += platform platform/common pico pico/cd pico/pico pico/32x pico/sound pico/carthw/svp \ |
| 112 | cpu cpu/musashi cpu/cz80 cpu/fame cpu/sh2/mame cpu/drc |
| 113 | |
| 114 | |
| 115 | # common rules |
| 116 | .c.o: |
| 117 | @echo ">>>" $< |
| 118 | $(CC) $(CFLAGS) -c $< -o $@ |
| 119 | .s.o: |
| 120 | @echo ">>>" $< |
| 121 | $(CC) $(CFLAGS) -c $< -o $@ |
| 122 | |
| 123 | clean_prof: |
| 124 | find ../.. -name '*.gcno' -delete |
| 125 | find ../.. -name '*.gcda' -delete |
| 126 | |
| 127 | mkdirs: |
| 128 | mkdir -p $(DIRS) |
| 129 | |
| 130 | ../../tools/textfilter: ../../tools/textfilter.c |
| 131 | make -C ../../tools/ textfilter |
| 132 | |
| 133 | |
| 134 | # random deps |
| 135 | pico/carthw/svp/compiler.o : ../../cpu/drc/emit_$(ARCH).c |
| 136 | cpu/sh2/compiler.o : ../../cpu/drc/emit_$(ARCH).c |
| 137 | cpu/sh2/mame/sh2pico.o : ../../cpu/sh2/mame/sh2.c |
| 138 | pico/pico.o pico/cd/pico.o : ../../pico/pico_cmn.c ../../pico/pico_int.h |
| 139 | pico/memory.o pico/cd/memory.o : ../../pico/pico_int.h ../../pico/memory.h |
| 140 | |
| 141 | ../../cpu/musashi/m68kops.c : |
| 142 | @make -C ../../cpu/musashi |
| 143 | |
| 144 | ../../cpu/mz80/mz80.asm : |
| 145 | @make -C ../../cpu/mz80/ |
| 146 | |
| 147 | cpu/fame/famec.o : ../../cpu/fame/famec.c ../../cpu/fame/famec_opcodes.h |
| 148 | @echo ">>>" $< |
| 149 | $(CC) $(CFLAGS) -Wno-unused -c $< -o $@ |
| 150 | |
| 151 | ../../cpu/Cyclone/proj/Cyclone.s: |
| 152 | @echo building Cyclone... |
| 153 | @make -C ../../cpu/Cyclone/proj CONFIG_FILE=config_pico.h |
| 154 | |