Automatic date update in version.in
[binutils-gdb.git] / sim / mips / local.mk
blob3af488fef5f69679f550f51635657ab9140fc1a1
1 ## See sim/Makefile.am
2 ##
3 ## Copyright (C) 1995-2024 Free Software Foundation, Inc.
4 ## Written by Cygnus Support.
5 ##
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 3 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
19 AM_CPPFLAGS_%C% = \
20 @SIM_MIPS_SUBTARGET@ \
21 -DWITH_TARGET_WORD_BITSIZE=@SIM_MIPS_BITSIZE@ -DWITH_TARGET_WORD_MSB=WITH_TARGET_WORD_BITSIZE-1 \
22 -DWITH_FLOATING_POINT=HARD_FLOATING_POINT -DWITH_TARGET_FLOATING_POINT_BITSIZE=@SIM_MIPS_FPU_BITSIZE@
24 %C%_GEN_OBJ =
25 if SIM_MIPS_GEN_MODE_SINGLE
26 %C%_GEN_OBJ += \
27 %D%/support.o \
28 %D%/itable.o \
29 %D%/semantics.o \
30 %D%/idecode.o \
31 %D%/icache.o \
32 %D%/engine.o \
33 %D%/irun.o
34 endif
35 if SIM_MIPS_GEN_MODE_M16
36 %C%_GEN_OBJ += \
37 %D%/m16_support.o \
38 %D%/m16_semantics.o \
39 %D%/m16_idecode.o \
40 %D%/m16_icache.o \
42 %D%/m32_support.o \
43 %D%/m32_semantics.o \
44 %D%/m32_idecode.o \
45 %D%/m32_icache.o \
47 %D%/itable.o \
48 %D%/m16run.o
49 endif
50 if SIM_MIPS_GEN_MODE_MULTI
51 %C%_GEN_OBJ += \
52 $(SIM_MIPS_MULTI_OBJ) \
53 %D%/itable.o \
54 %D%/multi-run.o
55 endif
56 nodist_%C%_libsim_a_SOURCES = \
57 %D%/modules.c
58 %C%_libsim_a_SOURCES = \
59 $(common_libcommon_a_SOURCES)
60 %C%_libsim_a_LIBADD = \
61 %D%/interp.o \
62 $(%C%_GEN_OBJ) \
63 $(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
64 $(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
65 $(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
66 %D%/cp1.o \
67 %D%/dsp.o \
68 %D%/mdmx.o \
69 %D%/sim-main.o \
70 %D%/sim-resume.o
71 ## Workaround Automake bug where $(SIM_MIPS_MULTI_OBJ) isn't copied from LIBADD
72 ## to DEPENDENCIES automatically.
73 EXTRA_mips_libsim_a_DEPENDENCIES = $(SIM_MIPS_MULTI_OBJ)
74 $(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
76 noinst_LIBRARIES += %D%/libsim.a
78 ## Override wildcards that trigger common/modules.c to be (incorrectly) used.
79 %D%/modules.o: %D%/modules.c
81 %D%/%.o: common/%.c ; $(SIM_COMPILE)
82 -@am__include@ %D%/$(DEPDIR)/*.Po
84 %C%_run_SOURCES =
85 %C%_run_LDADD = \
86 %D%/nrun.o \
87 %D%/libsim.a \
88 $(SIM_COMMON_LIBS)
90 noinst_PROGRAMS += %D%/run
92 %C%_SIM_EXTRA_HW_DEVICES = tx3904cpu tx3904irc tx3904tmr tx3904sio
94 ## List all generated headers to help Automake dependency tracking.
95 BUILT_SOURCES += %D%/itable.h
96 ## The multi files are a bit of a mess with generated multirun files depending
97 ## on generated igen files. Be lazy for now and declare them all built so they
98 ## are generated early on.
99 BUILT_SOURCES += $(SIM_MIPS_MULTI_SRC)
100 %C%_BUILT_SRC_FROM_IGEN_ITABLE = \
101 %D%/itable.h \
102 %D%/itable.c
103 %C%_BUILT_SRC_FROM_GEN_MODE_SINGLE = \
104 %D%/icache.h \
105 %D%/icache.c \
106 %D%/idecode.h \
107 %D%/idecode.c \
108 %D%/semantics.h \
109 %D%/semantics.c \
110 %D%/model.h \
111 %D%/model.c \
112 %D%/support.h \
113 %D%/support.c \
114 %D%/engine.h \
115 %D%/engine.c \
116 %D%/irun.c
117 %C%_BUILT_SRC_FROM_GEN_MODE_M16_M16 = \
118 %D%/m16_icache.h \
119 %D%/m16_icache.c \
120 %D%/m16_idecode.h \
121 %D%/m16_idecode.c \
122 %D%/m16_semantics.h \
123 %D%/m16_semantics.c \
124 %D%/m16_model.h \
125 %D%/m16_model.c \
126 %D%/m16_support.h \
127 %D%/m16_support.c \
128 %C%_BUILT_SRC_FROM_GEN_MODE_M16_M32 = \
129 %D%/m32_icache.h \
130 %D%/m32_icache.c \
131 %D%/m32_idecode.h \
132 %D%/m32_idecode.c \
133 %D%/m32_semantics.h \
134 %D%/m32_semantics.c \
135 %D%/m32_model.h \
136 %D%/m32_model.c \
137 %D%/m32_support.h \
138 %D%/m32_support.c
139 %C%_BUILD_OUTPUTS = \
140 $(%C%_BUILT_SRC_FROM_IGEN_ITABLE) \
141 %D%/stamp-igen-itable
142 if SIM_MIPS_GEN_MODE_SINGLE
143 %C%_BUILD_OUTPUTS += \
144 $(%C%_BUILT_SRC_FROM_GEN_MODE_SINGLE) \
145 %D%/stamp-gen-mode-single
146 endif
147 if SIM_MIPS_GEN_MODE_M16
148 %C%_BUILD_OUTPUTS += \
149 $(%C%_BUILT_SRC_FROM_GEN_MODE_M16_M16) \
150 $(%C%_BUILT_SRC_FROM_GEN_MODE_M16_M32) \
151 %D%/stamp-gen-mode-m16-m16 \
152 %D%/stamp-gen-mode-m16-m32
153 endif
154 if SIM_MIPS_GEN_MODE_MULTI
155 %C%_BUILD_OUTPUTS += \
156 $(SIM_MIPS_MULTI_SRC) \
157 %D%/stamp-gen-mode-multi-igen \
158 %D%/stamp-gen-mode-multi-run
159 endif
161 ## Generating modules.c requires all sources to scan.
162 %D%/modules.c: | $(%C%_BUILD_OUTPUTS)
164 $(%C%_BUILT_SRC_FROM_IGEN_ITABLE): %D%/stamp-igen-itable
165 $(%C%_BUILT_SRC_FROM_GEN_MODE_SINGLE): %D%/stamp-gen-mode-single
166 $(%C%_BUILT_SRC_FROM_GEN_MODE_M16_M16): %D%/stamp-gen-mode-m16-m16
167 $(%C%_BUILT_SRC_FROM_GEN_MODE_M16_M32): %D%/stamp-gen-mode-m16-m32
168 $(SIM_MIPS_MULTI_SRC): %D%/stamp-gen-mode-multi-igen %D%/stamp-gen-mode-multi-run
170 %C%_IGEN_TRACE = # -G omit-line-numbers # -G trace-rule-selection -G trace-rule-rejection -G trace-entries # -G trace-all
171 %C%_IGEN_INSN = $(srcdir)/%D%/mips.igen
172 %C%_IGEN_INSN_INC = \
173 %D%/dsp.igen \
174 %D%/dsp2.igen \
175 %D%/m16.igen \
176 %D%/m16e.igen \
177 %D%/mdmx.igen \
178 %D%/micromipsdsp.igen \
179 %D%/micromips.igen \
180 %D%/mips3264r2.igen \
181 %D%/mips3264r6.igen \
182 %D%/mips3d.igen \
183 %D%/sb1.igen \
184 %D%/tx.igen \
185 %D%/vr.igen
186 %C%_IGEN_DC = $(srcdir)/%D%/mips.dc
187 %C%_M16_DC = $(srcdir)/%D%/m16.dc
188 %C%_MICROMIPS32_DC = $(srcdir)/%D%/micromips.dc
189 %C%_MICROMIPS16_DC = $(srcdir)/%D%/micromips16.dc
191 ## NB: Since these can be built by a number of generators, care
192 ## must be taken to ensure that they are only dependant on
193 ## one of those generators.
194 %D%/stamp-igen-itable: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(IGEN)
195 $(AM_V_GEN)$(IGEN_RUN) \
196 $(%C%_IGEN_TRACE) \
197 -I $(srcdir)/%D% \
198 -Werror \
199 -Wnodiscard \
200 -Wnowidth \
201 -Wnounimplemented \
202 $(SIM_MIPS_IGEN_ITABLE_FLAGS) \
203 -G gen-direct-access \
204 -G gen-zero-r0 \
205 -i $(%C%_IGEN_INSN) \
206 -n itable.h -ht %D%/itable.h \
207 -n itable.c -t %D%/itable.c
208 $(AM_V_at)touch $@
210 %D%/stamp-gen-mode-single: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(%C%_IGEN_DC) $(IGEN)
211 $(AM_V_GEN)$(IGEN_RUN) \
212 $(%C%_IGEN_TRACE) \
213 -I $(srcdir)/%D% \
214 -Werror \
215 -Wnodiscard \
216 $(SIM_MIPS_SINGLE_FLAGS) \
217 -G gen-direct-access \
218 -G gen-zero-r0 \
219 -B 32 \
220 -H 31 \
221 -i $(%C%_IGEN_INSN) \
222 -o $(%C%_IGEN_DC) \
223 -x \
224 -n icache.h -hc %D%/icache.h \
225 -n icache.c -c %D%/icache.c \
226 -n semantics.h -hs %D%/semantics.h \
227 -n semantics.c -s %D%/semantics.c \
228 -n idecode.h -hd %D%/idecode.h \
229 -n idecode.c -d %D%/idecode.c \
230 -n model.h -hm %D%/model.h \
231 -n model.c -m %D%/model.c \
232 -n support.h -hf %D%/support.h \
233 -n support.c -f %D%/support.c \
234 -n engine.h -he %D%/engine.h \
235 -n engine.c -e %D%/engine.c \
236 -n irun.c -r %D%/irun.c
237 $(AM_V_at)touch $@
239 %D%/stamp-gen-mode-m16-m16: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(%C%_M16_DC) $(IGEN)
240 $(AM_V_GEN)$(IGEN_RUN) \
241 $(%C%_IGEN_TRACE) \
242 -I $(srcdir)/%D% \
243 -Werror \
244 -Wnodiscard \
245 $(SIM_MIPS_M16_FLAGS) \
246 -G gen-direct-access \
247 -G gen-zero-r0 \
248 -B 16 \
249 -H 15 \
250 -i $(%C%_IGEN_INSN) \
251 -o $(%C%_M16_DC) \
252 -P m16_ \
253 -x \
254 -n m16_icache.h -hc %D%/m16_icache.h \
255 -n m16_icache.c -c %D%/m16_icache.c \
256 -n m16_semantics.h -hs %D%/m16_semantics.h \
257 -n m16_semantics.c -s %D%/m16_semantics.c \
258 -n m16_idecode.h -hd %D%/m16_idecode.h \
259 -n m16_idecode.c -d %D%/m16_idecode.c \
260 -n m16_model.h -hm %D%/m16_model.h \
261 -n m16_model.c -m %D%/m16_model.c \
262 -n m16_support.h -hf %D%/m16_support.h \
263 -n m16_support.c -f %D%/m16_support.c
264 $(AM_V_at)touch $@
266 %D%/stamp-gen-mode-m16-m32: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(%C%_IGEN_DC) $(IGEN)
267 $(AM_V_GEN)$(IGEN_RUN) \
268 $(%C%_IGEN_TRACE) \
269 -I $(srcdir)/%D% \
270 -Werror \
271 -Wnodiscard \
272 $(SIM_MIPS_SINGLE_FLAGS) \
273 -G gen-direct-access \
274 -G gen-zero-r0 \
275 -B 32 \
276 -H 31 \
277 -i $(%C%_IGEN_INSN) \
278 -o $(%C%_IGEN_DC) \
279 -P m32_ \
280 -x \
281 -n m32_icache.h -hc %D%/m32_icache.h \
282 -n m32_icache.c -c %D%/m32_icache.c \
283 -n m32_semantics.h -hs %D%/m32_semantics.h \
284 -n m32_semantics.c -s %D%/m32_semantics.c \
285 -n m32_idecode.h -hd %D%/m32_idecode.h \
286 -n m32_idecode.c -d %D%/m32_idecode.c \
287 -n m32_model.h -hm %D%/m32_model.h \
288 -n m32_model.c -m %D%/m32_model.c \
289 -n m32_support.h -hf %D%/m32_support.h \
290 -n m32_support.c -f %D%/m32_support.c
291 $(AM_V_at)touch $@
293 %D%/stamp-gen-mode-multi-igen: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(%C%_IGEN_DC) $(%C%_M16_DC) $(%C%_MICROMIPS32_DC) $(%C%_MICROMIPS16_DC) $(IGEN)
294 $(AM_V_GEN)\
295 for t in $(SIM_MIPS_MULTI_IGEN_CONFIGS); do \
296 p=`echo $${t} | sed -e 's/:.*//'` ; \
297 m=`echo $${t} | sed -e 's/.*:\(.*\):.*/\1/'` ; \
298 f=`echo $${t} | sed -e 's/.*://'` ; \
299 case $${p} in \
300 micromips16*) \
301 e="-B 16 -H 15 -o $(%C%_MICROMIPS16_DC) -F 16" ;; \
302 micromips32* | micromips64*) \
303 e="-B 32 -H 31 -o $(%C%_MICROMIPS32_DC) -F $${f}" ;; \
304 micromips_m32*) \
305 e="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}"; \
306 m="mips32r2,mips3d,mdmx,dsp,dsp2,smartmips" ;; \
307 micromips_m64*) \
308 e="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}"; \
309 m="mips64r2,mips3d,mdmx,dsp,dsp2,smartmips" ;; \
310 m16*) \
311 e="-B 16 -H 15 -o $(%C%_M16_DC) -F 16" ;; \
312 *) \
313 e="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}" ;; \
314 esac; \
315 $(IGEN_RUN) \
316 $(%C%_IGEN_TRACE) \
317 $${e} \
318 -I $(srcdir)/%D% \
319 -Werror \
320 -Wnodiscard \
321 -M $${m} \
322 -G gen-direct-access \
323 -G gen-zero-r0 \
324 -i $(%C%_IGEN_INSN) \
325 -P $${p}_ \
326 -x \
327 -n $${p}_icache.h -hc %D%/$${p}_icache.h \
328 -n $${p}_icache.c -c %D%/$${p}_icache.c \
329 -n $${p}_semantics.h -hs %D%/$${p}_semantics.h \
330 -n $${p}_semantics.c -s %D%/$${p}_semantics.c \
331 -n $${p}_idecode.h -hd %D%/$${p}_idecode.h \
332 -n $${p}_idecode.c -d %D%/$${p}_idecode.c \
333 -n $${p}_model.h -hm %D%/$${p}_model.h \
334 -n $${p}_model.c -m %D%/$${p}_model.c \
335 -n $${p}_support.h -hf %D%/$${p}_support.h \
336 -n $${p}_support.c -f %D%/$${p}_support.c \
337 -n $${p}_engine.h -he %D%/$${p}_engine.h \
338 -n $${p}_engine.c -e %D%/$${p}_engine.c \
339 || exit; \
340 done
341 $(AM_V_at)touch $@
343 %D%/stamp-gen-mode-multi-run: %D%/m16run.c %D%/micromipsrun.c
344 $(AM_V_GEN)\
345 for t in $(SIM_MIPS_MULTI_IGEN_CONFIGS); do \
346 case $${t} in \
347 m16*) \
348 m=`echo $${t} | sed -e 's/^m16//' -e 's/:.*//'`; \
349 o=%D%/m16$${m}_run.c; \
350 sed < $(srcdir)/%D%/m16run.c > $$o.tmp \
351 -e "s/^sim_/m16$${m}_/" \
352 -e "/include/s/sim-engine/m16$${m}_engine/" \
353 -e "s/m16_/m16$${m}_/" \
354 -e "s/m32_/m32$${m}_/" \
355 || exit 1; \
356 $(SHELL) $(srcroot)/move-if-change $$o.tmp $$o; \
358 micromips32*) \
359 m=`echo $${t} | sed -e 's/^micromips32//' -e 's/:.*//'`; \
360 o=%D%/micromips$${m}_run.c; \
361 sed < $(srcdir)/%D%/micromipsrun.c > $$o.tmp \
362 -e "s/^sim_/micromips32$${m}_/" \
363 -e "/include/s/sim-engine/micromips32$${m}_engine/" \
364 -e "s/micromips16_/micromips16$${m}_/" \
365 -e "s/micromips32_/micromips32$${m}_/" \
366 -e "s/m32_/m32$${m}_/" \
367 || exit 1; \
368 $(SHELL) $(srcroot)/move-if-change $$o.tmp $$o; \
370 micromips64*) \
371 m=`echo $${t} | sed -e 's/^micromips64//' -e 's/:.*//'`; \
372 o=%D%/micromips$${m}_run.c; \
373 sed < $(srcdir)/%D%/micromipsrun.c > $$o.tmp \
374 -e "s/^sim_/micromips64$${m}_/" \
375 -e "/include/s/sim-engine/micromips64$${m}_engine/" \
376 -e "s/micromips16_/micromips16$${m}_/" \
377 -e "s/micromips32_/micromips64$${m}_/" \
378 -e "s/m32_/m64$${m}_/" \
379 || exit 1; \
380 $(SHELL) $(srcroot)/move-if-change $$o.tmp $$o; \
382 esac \
383 done
384 $(AM_V_at)touch $@
386 MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
387 ## These are created by mips/acinclude.m4 during configure time.
388 DISTCLEANFILES += %D%/multi-include.h %D%/multi-run.c