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