sim: mn10300: move libsim.a creation to top-level
[binutils-gdb.git] / sim / Makefile.am
1 ## Process this file with automake to generate Makefile.in
2 ##
3 # Copyright (C) 1993-2023 Free Software Foundation, Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
19 ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
20
21 GNULIB_PARENT_DIR = ..
22 @am__include@ @am__quote@$(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc@am__quote@
23
24 srccom = $(srcdir)/common
25 srcroot = $(srcdir)/..
26
27 SUBDIRS = @subdirs@ $(SIM_SUBDIRS)
28
29 SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
30 AM_MAKEFLAGS =
31
32 ## We don't set some of these vars here, but we need to define them so they may
33 ## be used consistently in local.mk files we include below.
34 pkginclude_HEADERS =
35 check_PROGRAMS =
36 noinst_PROGRAMS =
37 noinst_LIBRARIES =
38 EXTRA_PROGRAMS =
39 BUILT_SOURCES =
40
41 CLEANFILES =
42 DISTCLEANFILES =
43 MOSTLYCLEANFILES = core
44
45 AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
46 AM_CPPFLAGS = \
47 $(INCGNU) \
48 -I$(srcroot)/include \
49 -I../bfd \
50 -I.. \
51 $(SIM_HW_CFLAGS) \
52 $(SIM_INLINE)
53
54 AM_CPPFLAGS_FOR_BUILD = \
55 -I$(srcroot)/include \
56 $(SIM_HW_CFLAGS) \
57 $(SIM_INLINE)
58 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
59 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
60
61 ## Deps to add to the all-recursive target. These are built before descending
62 ## into any subdirs.
63 SIM_ALL_RECURSIVE_DEPS =
64 ## Deps to add to the install-data-local target.
65 SIM_INSTALL_DATA_LOCAL_DEPS =
66 ## Deps to add to the install-exec-local target.
67 SIM_INSTALL_EXEC_LOCAL_DEPS =
68 ## Deps to add to the uninstall-local target.
69 SIM_UNINSTALL_LOCAL_DEPS =
70
71 # Generate target constants for newlib/libgloss from its source tree.
72 # This file is shipped with distributions so we build in the source dir.
73 # Use `make nltvals' to rebuild.
74 .PHONY: nltvals
75 nltvals:
76 $(srccom)/gennltvals.py --cpp "$(CPP)"
77
78 if ENABLE_SIM
79 pkginclude_HEADERS += \
80 $(srcroot)/include/sim/callback.h \
81 $(srcroot)/include/sim/sim.h
82 endif
83
84 include common/local.mk
85 if SIM_ENABLE_IGEN
86 include igen/local.mk
87 endif
88 include testsuite/local.mk
89
90 ## Arch includes must come after common/local.mk.
91 if SIM_ENABLE_ARCH_aarch64
92 include aarch64/local.mk
93 endif
94 if SIM_ENABLE_ARCH_arm
95 include arm/local.mk
96 endif
97 if SIM_ENABLE_ARCH_avr
98 include avr/local.mk
99 endif
100 if SIM_ENABLE_ARCH_bfin
101 include bfin/local.mk
102 endif
103 if SIM_ENABLE_ARCH_bpf
104 include bpf/local.mk
105 endif
106 if SIM_ENABLE_ARCH_cr16
107 include cr16/local.mk
108 endif
109 if SIM_ENABLE_ARCH_cris
110 include cris/local.mk
111 endif
112 if SIM_ENABLE_ARCH_d10v
113 include d10v/local.mk
114 endif
115 if SIM_ENABLE_ARCH_erc32
116 include erc32/local.mk
117 endif
118 if SIM_ENABLE_ARCH_examples
119 include example-synacor/local.mk
120 endif
121 if SIM_ENABLE_ARCH_frv
122 include frv/local.mk
123 endif
124 if SIM_ENABLE_ARCH_ft32
125 include ft32/local.mk
126 endif
127 if SIM_ENABLE_ARCH_h8300
128 include h8300/local.mk
129 endif
130 if SIM_ENABLE_ARCH_iq2000
131 include iq2000/local.mk
132 endif
133 if SIM_ENABLE_ARCH_lm32
134 include lm32/local.mk
135 endif
136 if SIM_ENABLE_ARCH_m32c
137 include m32c/local.mk
138 endif
139 if SIM_ENABLE_ARCH_m32r
140 include m32r/local.mk
141 endif
142 if SIM_ENABLE_ARCH_m68hc11
143 include m68hc11/local.mk
144 endif
145 if SIM_ENABLE_ARCH_mcore
146 include mcore/local.mk
147 endif
148 if SIM_ENABLE_ARCH_microblaze
149 include microblaze/local.mk
150 endif
151 if SIM_ENABLE_ARCH_mips
152 include mips/local.mk
153 endif
154 if SIM_ENABLE_ARCH_mn10300
155 include mn10300/local.mk
156 endif
157 if SIM_ENABLE_ARCH_moxie
158 include moxie/local.mk
159 endif
160 if SIM_ENABLE_ARCH_msp430
161 include msp430/local.mk
162 endif
163 if SIM_ENABLE_ARCH_or1k
164 include or1k/local.mk
165 endif
166 if SIM_ENABLE_ARCH_ppc
167 include ppc/local.mk
168 endif
169 if SIM_ENABLE_ARCH_pru
170 include pru/local.mk
171 endif
172 if SIM_ENABLE_ARCH_riscv
173 include riscv/local.mk
174 endif
175 if SIM_ENABLE_ARCH_rl78
176 include rl78/local.mk
177 endif
178 if SIM_ENABLE_ARCH_rx
179 include rx/local.mk
180 endif
181 if SIM_ENABLE_ARCH_sh
182 include sh/local.mk
183 endif
184 if SIM_ENABLE_ARCH_v850
185 include v850/local.mk
186 endif
187
188 ## Helper targets for running make from the top-level when some subdirs still
189 ## have Makefiles in subdirs.
190
191 %/libsim.a: | $(SIM_ALL_RECURSIVE_DEPS)
192 $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
193
194 %/nrun.o: common/nrun.c | %/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
195 $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
196
197 all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
198
199 install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
200 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
201 lib=`echo sim | sed '$(program_transform_name)'`; \
202 for d in $(SIM_ENABLED_ARCHES); do \
203 n="$$lib"; \
204 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
205 n="lib$$n.a"; \
206 $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
207 done
208
209 install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
210 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
211 run=`echo run | sed '$(program_transform_name)'`; \
212 for d in $(SIM_ENABLED_ARCHES); do \
213 n="$$run"; \
214 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
215 $(LIBTOOL) --mode=install \
216 $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
217 done
218
219 uninstall-local: $(SIM_UNINSTALL_LOCAL_DEPS)
220 rm -f $(DESTDIR)$(bindir)/run $(DESTDIR)$(libdir)/libsim.a
221 for d in $(SIM_ENABLED_ARCHES); do \
222 rm -f $(DESTDIR)$(bindir)/run-$$d $(DESTDIR)$(libdir)/libsim-$$d.a; \
223 done