1## See sim/Makefile.am
2##
3## Copyright (C) 1996-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.
10##
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.
15##
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/>.
18
19AM_CPPFLAGS_%C% = \
20	-DPOLL_QUIT_INTERVAL=0x20 \
21	-DWITH_TARGET_WORD_BITSIZE=32 -DWITH_TARGET_WORD_MSB=31
22
23nodist_%C%_libsim_a_SOURCES = \
24	%D%/modules.c
25%C%_libsim_a_SOURCES = \
26	$(common_libcommon_a_SOURCES)
27%C%_libsim_a_LIBADD = \
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	%D%/support.o \
35	$(patsubst %,%D%/%,$(SIM_NEW_COMMON_OBJS)) \
36	$(patsubst %,%D%/dv-%.o,$(SIM_HW_DEVICES)) \
37	$(patsubst %,%D%/dv-%.o,$(%C%_SIM_EXTRA_HW_DEVICES)) \
38	%D%/interp.o \
39	%D%/op_utils.o \
40	%D%/sim-resume.o
41$(%C%_libsim_a_OBJECTS) $(%C%_libsim_a_LIBADD): %D%/hw-config.h
42
43noinst_LIBRARIES += %D%/libsim.a
44
45## Override wildcards that trigger common/modules.c to be (incorrectly) used.
46%D%/modules.o: %D%/modules.c
47
48%D%/%.o: common/%.c ; $(SIM_COMPILE)
49-@am__include@ %D%/$(DEPDIR)/*.Po
50
51%C%_run_SOURCES =
52%C%_run_LDADD = \
53	%D%/nrun.o \
54	%D%/libsim.a \
55	$(SIM_COMMON_LIBS)
56
57noinst_PROGRAMS += %D%/run
58
59%C%_SIM_EXTRA_HW_DEVICES = mn103cpu mn103int mn103tim mn103ser mn103iop
60
61## List all generated headers to help Automake dependency tracking.
62BUILT_SOURCES += \
63	%D%/icache.h \
64	%D%/idecode.h \
65	%D%/semantics.h \
66	%D%/model.h \
67	%D%/support.h \
68	%D%/itable.h \
69	%D%/engine.h
70%C%_BUILT_SRC_FROM_IGEN = \
71	%D%/icache.h \
72	%D%/icache.c \
73	%D%/idecode.h \
74	%D%/idecode.c \
75	%D%/semantics.h \
76	%D%/semantics.c \
77	%D%/model.h \
78	%D%/model.c \
79	%D%/support.h \
80	%D%/support.c \
81	%D%/itable.h \
82	%D%/itable.c \
83	%D%/engine.h \
84	%D%/engine.c \
85	%D%/irun.c
86%C%_BUILD_OUTPUTS = \
87	$(%C%_BUILT_SRC_FROM_IGEN) \
88	%D%/stamp-igen
89
90## Generating modules.c requires all sources to scan.
91%D%/modules.c: | $(%C%_BUILD_OUTPUTS)
92
93$(%C%_BUILT_SRC_FROM_IGEN): %D%/stamp-igen
94
95%C%_IGEN_TRACE = # -G omit-line-numbers # -G trace-rule-selection -G trace-rule-rejection -G trace-entries
96%C%_IGEN_INSN = $(srcdir)/%D%/mn10300.igen
97%C%_IGEN_INSN_INC = %D%/am33.igen %D%/am33-2.igen
98%C%_IGEN_DC = $(srcdir)/%D%/mn10300.dc
99%D%/stamp-igen: $(%C%_IGEN_INSN) $(%C%_IGEN_INSN_INC) $(%C%_IGEN_DC) $(IGEN)
100	$(AM_V_GEN)$(IGEN_RUN) \
101		$(%C%_IGEN_TRACE) \
102		-G gen-direct-access \
103		-M mn10300,am33 -G gen-multi-sim=am33 \
104		-M am33_2 \
105		-I $(srcdir)/%D% \
106		-i $(%C%_IGEN_INSN) \
107		-o $(%C%_IGEN_DC) \
108		-x \
109		-n icache.h    -hc %D%/icache.h \
110		-n icache.c    -c  %D%/icache.c \
111		-n semantics.h -hs %D%/semantics.h \
112		-n semantics.c -s  %D%/semantics.c \
113		-n idecode.h   -hd %D%/idecode.h \
114		-n idecode.c   -d  %D%/idecode.c \
115		-n model.h     -hm %D%/model.h \
116		-n model.c     -m  %D%/model.c \
117		-n support.h   -hf %D%/support.h \
118		-n support.c   -f  %D%/support.c \
119		-n itable.h    -ht %D%/itable.h \
120		-n itable.c    -t  %D%/itable.c \
121		-n engine.h    -he %D%/engine.h \
122		-n engine.c    -e  %D%/engine.c \
123		-n irun.c      -r  %D%/irun.c
124	$(AM_V_at)touch $@
125
126MOSTLYCLEANFILES += $(%C%_BUILD_OUTPUTS)
127