3 ## Copyright (C) 1995-2024 Free Software Foundation, Inc.
4 ## Written by Cygnus Support.
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/>.
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@
25 if SIM_MIPS_GEN_MODE_SINGLE
35 if SIM_MIPS_GEN_MODE_M16
50 if SIM_MIPS_GEN_MODE_MULTI
52 $(SIM_MIPS_MULTI_OBJ
) \
56 nodist_
%C
%_libsim_a_SOURCES
= \
58 %C
%_libsim_a_SOURCES
= \
59 $(common_libcommon_a_SOURCES
)
60 %C
%_libsim_a_LIBADD
= \
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
)) \
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
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
= \
103 %C
%_BUILT_SRC_FROM_GEN_MODE_SINGLE
= \
117 %C
%_BUILT_SRC_FROM_GEN_MODE_M16_M16
= \
122 %D
%/m16_semantics.h \
123 %D
%/m16_semantics.c \
128 %C
%_BUILT_SRC_FROM_GEN_MODE_M16_M32
= \
133 %D
%/m32_semantics.h \
134 %D
%/m32_semantics.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
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
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
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
= \
178 %D
%/micromipsdsp.igen \
180 %D
%/mips3264r2.igen \
181 %D
%/mips3264r6.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
) \
202 $(SIM_MIPS_IGEN_ITABLE_FLAGS
) \
203 -G gen-direct-access \
205 -i
$(%C
%_IGEN_INSN
) \
206 -n itable.h
-ht
%D
%/itable.h \
207 -n itable.c
-t
%D
%/itable.c
210 %D
%/stamp-gen-mode-single
: $(%C
%_IGEN_INSN
) $(%C
%_IGEN_INSN_INC
) $(%C
%_IGEN_DC
) $(IGEN
)
211 $(AM_V_GEN
)$(IGEN_RUN
) \
216 $(SIM_MIPS_SINGLE_FLAGS
) \
217 -G gen-direct-access \
221 -i
$(%C
%_IGEN_INSN
) \
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
239 %D
%/stamp-gen-mode-m16-m16
: $(%C
%_IGEN_INSN
) $(%C
%_IGEN_INSN_INC
) $(%C
%_M16_DC
) $(IGEN
)
240 $(AM_V_GEN
)$(IGEN_RUN
) \
245 $(SIM_MIPS_M16_FLAGS
) \
246 -G gen-direct-access \
250 -i
$(%C
%_IGEN_INSN
) \
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
266 %D
%/stamp-gen-mode-m16-m32
: $(%C
%_IGEN_INSN
) $(%C
%_IGEN_INSN_INC
) $(%C
%_IGEN_DC
) $(IGEN
)
267 $(AM_V_GEN
)$(IGEN_RUN
) \
272 $(SIM_MIPS_SINGLE_FLAGS
) \
273 -G gen-direct-access \
277 -i
$(%C
%_IGEN_INSN
) \
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
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
)
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/.*://'` ; \
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}" ;; \
305 e
="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}"; \
306 m
="mips32r2,mips3d,mdmx,dsp,dsp2,smartmips" ;; \
308 e
="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}"; \
309 m
="mips64r2,mips3d,mdmx,dsp,dsp2,smartmips" ;; \
311 e
="-B 16 -H 15 -o $(%C%_M16_DC) -F 16" ;; \
313 e
="-B 32 -H 31 -o $(%C%_IGEN_DC) -F $${f}" ;; \
322 -G gen-direct-access \
324 -i
$(%C
%_IGEN_INSN
) \
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 \
343 %D
%/stamp-gen-mode-multi-run
: %D
%/m16run.c
%D
%/micromipsrun.c
345 for t in
$(SIM_MIPS_MULTI_IGEN_CONFIGS
); do \
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}_/" \
356 $(SHELL
) $(srcroot
)/move-if-change
$$o.tmp
$$o; \
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}_/" \
368 $(SHELL
) $(srcroot
)/move-if-change
$$o.tmp
$$o; \
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}_/" \
380 $(SHELL
) $(srcroot
)/move-if-change
$$o.tmp
$$o; \
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