1 ## Process this file with automake to generate Makefile.in
3 # Copyright (C) 1993-2023 Free Software Foundation, Inc.
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.
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.
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/>.
18 AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
19 ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
21 GNULIB_PARENT_DIR = ..
22 @include_makefile@ $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
24 srccom = $(srcdir)/common
25 srcroot = $(srcdir)/..
27 SUBDIRS = @subdirs@ $(SIM_SUBDIRS)
29 SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
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.
42 MOSTLYCLEANFILES = core
44 AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
47 -I$(srcroot)/include \
53 AM_CPPFLAGS_FOR_BUILD = \
54 -I$(srcroot)/include \
57 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
58 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
60 ## Deps to add to the all-recursive target. These are built before descending
62 SIM_ALL_RECURSIVE_DEPS =
63 ## Deps to add to the install-data-local target.
64 SIM_INSTALL_DATA_LOCAL_DEPS =
65 ## Deps to add to the install-exec-local target.
66 SIM_INSTALL_EXEC_LOCAL_DEPS =
67 ## Deps to add to the uninstall-local target.
68 SIM_UNINSTALL_LOCAL_DEPS =
70 # Generate target constants for newlib/libgloss from its source tree.
71 # This file is shipped with distributions so we build in the source dir.
72 # Use `make nltvals' to rebuild.
75 $(srccom)/gennltvals.py --cpp "$(CPP)"
78 pkginclude_HEADERS += \
79 $(srcroot)/include/sim/callback.h \
80 $(srcroot)/include/sim/sim.h
83 include common/local.mk
87 include testsuite/local.mk
89 ## Arch includes must come after common/local.mk.
90 if SIM_ENABLE_ARCH_aarch64
91 include aarch64/local.mk
93 if SIM_ENABLE_ARCH_arm
96 if SIM_ENABLE_ARCH_avr
99 if SIM_ENABLE_ARCH_bfin
100 include bfin/local.mk
102 if SIM_ENABLE_ARCH_bpf
105 if SIM_ENABLE_ARCH_cr16
106 include cr16/local.mk
108 if SIM_ENABLE_ARCH_cris
109 include cris/local.mk
111 if SIM_ENABLE_ARCH_d10v
112 include d10v/local.mk
114 if SIM_ENABLE_ARCH_erc32
115 include erc32/local.mk
117 if SIM_ENABLE_ARCH_examples
118 include example-synacor/local.mk
120 if SIM_ENABLE_ARCH_frv
123 if SIM_ENABLE_ARCH_ft32
124 include ft32/local.mk
126 if SIM_ENABLE_ARCH_h8300
127 include h8300/local.mk
129 if SIM_ENABLE_ARCH_iq2000
130 include iq2000/local.mk
132 if SIM_ENABLE_ARCH_lm32
133 include lm32/local.mk
135 if SIM_ENABLE_ARCH_m32c
136 include m32c/local.mk
138 if SIM_ENABLE_ARCH_m32r
139 include m32r/local.mk
141 if SIM_ENABLE_ARCH_m68hc11
142 include m68hc11/local.mk
144 if SIM_ENABLE_ARCH_mcore
145 include mcore/local.mk
147 if SIM_ENABLE_ARCH_microblaze
148 include microblaze/local.mk
150 if SIM_ENABLE_ARCH_mips
151 include mips/local.mk
153 if SIM_ENABLE_ARCH_mn10300
154 include mn10300/local.mk
156 if SIM_ENABLE_ARCH_moxie
157 include moxie/local.mk
159 if SIM_ENABLE_ARCH_msp430
160 include msp430/local.mk
162 if SIM_ENABLE_ARCH_or1k
163 include or1k/local.mk
165 if SIM_ENABLE_ARCH_ppc
168 if SIM_ENABLE_ARCH_pru
171 if SIM_ENABLE_ARCH_riscv
172 include riscv/local.mk
174 if SIM_ENABLE_ARCH_rl78
175 include rl78/local.mk
177 if SIM_ENABLE_ARCH_rx
180 if SIM_ENABLE_ARCH_sh
183 if SIM_ENABLE_ARCH_v850
184 include v850/local.mk
187 ## Helper targets for running make from the top-level when some subdirs still
188 ## have Makefiles in subdirs.
190 %/libsim.a: | $(SIM_ALL_RECURSIVE_DEPS)
191 $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
193 %/nrun.o: common/nrun.c | %/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
194 $(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
196 all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
198 install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
199 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
200 lib=`echo sim | sed '$(program_transform_name)'`; \
201 for d in $(SIM_ENABLED_ARCHES); do \
203 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
205 $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
208 install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
209 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
210 run=`echo run | sed '$(program_transform_name)'`; \
211 for d in $(SIM_ENABLED_ARCHES); do \
213 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
214 $(LIBTOOL) --mode=install \
215 $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
218 uninstall-local: $(SIM_UNINSTALL_LOCAL_DEPS)
219 rm -f $(DESTDIR)$(bindir)/run $(DESTDIR)$(libdir)/libsim.a
220 for d in $(SIM_ENABLED_ARCHES); do \
221 rm -f $(DESTDIR)$(bindir)/run-$$d $(DESTDIR)$(libdir)/libsim-$$d.a; \