xref: /netbsd-src/external/gpl3/gdb/dist/sim/Makefile.am (revision 3f351f34c6d827cf017cdcff3543f6ec0c88b420)
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
18AUTOMAKE_OPTIONS = dejagnu foreign no-dist subdir-objects
19ACLOCAL_AMFLAGS = -Im4 -I.. -I../config
20
21GNULIB_PARENT_DIR = ..
22@include_makefile@ $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
23
24srccom = $(srcdir)/common
25srcroot = $(srcdir)/..
26
27SUBDIRS = @subdirs@ $(SIM_SUBDIRS)
28
29SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
30AM_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.
34pkginclude_HEADERS =
35check_PROGRAMS =
36noinst_PROGRAMS =
37noinst_LIBRARIES =
38EXTRA_PROGRAMS =
39
40CLEANFILES =
41DISTCLEANFILES =
42MOSTLYCLEANFILES = core
43
44AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
45AM_CPPFLAGS = \
46	$(INCGNU) \
47	-I$(srcroot)/include \
48	-I../bfd \
49	-I.. \
50	$(SIM_HW_CFLAGS) \
51	$(SIM_INLINE)
52
53AM_CPPFLAGS_FOR_BUILD = \
54	-I$(srcroot)/include \
55	$(SIM_HW_CFLAGS) \
56	$(SIM_INLINE)
57COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
58LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
59
60## Deps to add to the all-recursive target.  These are built before descending
61## into any subdirs.
62SIM_ALL_RECURSIVE_DEPS =
63## Deps to add to the install-data-local target.
64SIM_INSTALL_DATA_LOCAL_DEPS =
65## Deps to add to the install-exec-local target.
66SIM_INSTALL_EXEC_LOCAL_DEPS =
67## Deps to add to the uninstall-local target.
68SIM_UNINSTALL_LOCAL_DEPS =
69
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.
73.PHONY: nltvals
74nltvals:
75	$(srccom)/gennltvals.py --cpp "$(CPP)"
76
77if ENABLE_SIM
78pkginclude_HEADERS += \
79	$(srcroot)/include/sim/callback.h \
80	$(srcroot)/include/sim/sim.h
81endif
82
83include common/local.mk
84if SIM_ENABLE_IGEN
85include igen/local.mk
86endif
87include testsuite/local.mk
88
89## Arch includes must come after common/local.mk.
90if SIM_ENABLE_ARCH_aarch64
91include aarch64/local.mk
92endif
93if SIM_ENABLE_ARCH_arm
94include arm/local.mk
95endif
96if SIM_ENABLE_ARCH_avr
97include avr/local.mk
98endif
99if SIM_ENABLE_ARCH_bfin
100include bfin/local.mk
101endif
102if SIM_ENABLE_ARCH_bpf
103include bpf/local.mk
104endif
105if SIM_ENABLE_ARCH_cr16
106include cr16/local.mk
107endif
108if SIM_ENABLE_ARCH_cris
109include cris/local.mk
110endif
111if SIM_ENABLE_ARCH_d10v
112include d10v/local.mk
113endif
114if SIM_ENABLE_ARCH_erc32
115include erc32/local.mk
116endif
117if SIM_ENABLE_ARCH_examples
118include example-synacor/local.mk
119endif
120if SIM_ENABLE_ARCH_frv
121include frv/local.mk
122endif
123if SIM_ENABLE_ARCH_ft32
124include ft32/local.mk
125endif
126if SIM_ENABLE_ARCH_h8300
127include h8300/local.mk
128endif
129if SIM_ENABLE_ARCH_iq2000
130include iq2000/local.mk
131endif
132if SIM_ENABLE_ARCH_lm32
133include lm32/local.mk
134endif
135if SIM_ENABLE_ARCH_m32c
136include m32c/local.mk
137endif
138if SIM_ENABLE_ARCH_m32r
139include m32r/local.mk
140endif
141if SIM_ENABLE_ARCH_m68hc11
142include m68hc11/local.mk
143endif
144if SIM_ENABLE_ARCH_mcore
145include mcore/local.mk
146endif
147if SIM_ENABLE_ARCH_microblaze
148include microblaze/local.mk
149endif
150if SIM_ENABLE_ARCH_mips
151include mips/local.mk
152endif
153if SIM_ENABLE_ARCH_mn10300
154include mn10300/local.mk
155endif
156if SIM_ENABLE_ARCH_moxie
157include moxie/local.mk
158endif
159if SIM_ENABLE_ARCH_msp430
160include msp430/local.mk
161endif
162if SIM_ENABLE_ARCH_or1k
163include or1k/local.mk
164endif
165if SIM_ENABLE_ARCH_ppc
166include ppc/local.mk
167endif
168if SIM_ENABLE_ARCH_pru
169include pru/local.mk
170endif
171if SIM_ENABLE_ARCH_riscv
172include riscv/local.mk
173endif
174if SIM_ENABLE_ARCH_rl78
175include rl78/local.mk
176endif
177if SIM_ENABLE_ARCH_rx
178include rx/local.mk
179endif
180if SIM_ENABLE_ARCH_sh
181include sh/local.mk
182endif
183if SIM_ENABLE_ARCH_v850
184include v850/local.mk
185endif
186
187## Helper targets for running make from the top-level when some subdirs still
188## have Makefiles in subdirs.
189
190%/libsim.a: | $(SIM_ALL_RECURSIVE_DEPS)
191	$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
192
193%/nrun.o: common/nrun.c | %/libsim.a $(SIM_ALL_RECURSIVE_DEPS)
194	$(MAKE) $(AM_MAKEFLAGS) -C $(@D) $(@F)
195
196all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
197
198install-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 \
202		n="$$lib"; \
203		[ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
204		n="lib$$n.a"; \
205		$(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
206	done
207
208install-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 \
212		n="$$run"; \
213		[ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
214		$(LIBTOOL) --mode=install \
215			$(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
216	done
217
218uninstall-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; \
222	done
223