PR29991, MicroMIPS flag erased after align directives
[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@
28
29 SIM_PRIMARY_TARGET = @SIM_PRIMARY_TARGET@
30
31 ## We don't set some of these vars here, but we need to define them so they may
32 ## be used consistently in local.mk files we include below.
33 pkginclude_HEADERS =
34 check_PROGRAMS =
35 noinst_PROGRAMS =
36 EXTRA_LIBRARIES =
37 noinst_LIBRARIES =
38 EXTRA_PROGRAMS =
39 BUILT_SOURCES =
40
41 CLEANFILES =
42 DISTCLEANFILES =
43 MOSTLYCLEANFILES = core
44 ## We build some objects ourselves directly that Automake doesn't track, so
45 ## make sure all objects in subdirs get cleaned up.
46 MOSTLYCLEANFILES += $(SIM_ENABLED_ARCHES:%=%/*.o)
47
48 AM_CFLAGS = \
49 $(WERROR_CFLAGS) \
50 $(WARN_CFLAGS) \
51 $(AM_CFLAGS_$(subst -,_,$(@D))) \
52 $(AM_CFLAGS_$(subst -,_,$(@D)_$(@F)))
53 AM_CPPFLAGS = \
54 $(INCGNU) \
55 -I$(srcroot) \
56 -I$(srcroot)/include \
57 -I../bfd \
58 -I.. \
59 -I$(@D) \
60 -I$(srcdir)/$(@D) \
61 $(SIM_HW_CFLAGS) \
62 $(SIM_INLINE) \
63 $(AM_CPPFLAGS_$(subst -,_,$(@D))) \
64 $(AM_CPPFLAGS_$(subst -,_,$(@D)_$(@F)))
65
66 AM_CPPFLAGS_FOR_BUILD = \
67 -I$(srcroot)/include \
68 $(SIM_HW_CFLAGS) \
69 $(SIM_INLINE)
70 COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(AM_CPPFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD)
71 LINK_FOR_BUILD = $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
72
73 ## Deps to add to the all-recursive target. These are built before descending
74 ## into any subdirs.
75 SIM_ALL_RECURSIVE_DEPS =
76 ## Deps to add to the install-data-local target.
77 SIM_INSTALL_DATA_LOCAL_DEPS =
78 ## Deps to add to the install-exec-local target.
79 SIM_INSTALL_EXEC_LOCAL_DEPS =
80 ## Deps to add to the uninstall-local target.
81 SIM_UNINSTALL_LOCAL_DEPS =
82
83 # Generate target constants for newlib/libgloss from its source tree.
84 # This file is shipped with distributions so we build in the source dir.
85 # Use `make nltvals' to rebuild.
86 .PHONY: nltvals
87 nltvals:
88 $(srccom)/gennltvals.py --cpp "$(CPP)"
89
90 if ENABLE_SIM
91 pkginclude_HEADERS += \
92 $(srcroot)/include/sim/callback.h \
93 $(srcroot)/include/sim/sim.h
94 endif
95
96 ## Used for our custom rules to calculate the dependency output base name.
97 ## This form aligns with Automake's default rules.
98 SIM_DEPBASE = $(@D)/$(DEPDIR)/$(@F:.o=)
99 ## Actual full compile command like Automake's default rules.
100 SIM_COMPILE = \
101 $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(SIM_DEPBASE).Tpo -c -o $@ $< && \
102 $(am__mv) $(SIM_DEPBASE).Tpo $(SIM_DEPBASE).Po
103
104 include common/local.mk
105 include igen/local.mk
106 include testsuite/local.mk
107
108 ## Arch includes must come after common/local.mk.
109 if SIM_ENABLE_ARCH_aarch64
110 include aarch64/local.mk
111 endif
112 if SIM_ENABLE_ARCH_arm
113 include arm/local.mk
114 endif
115 if SIM_ENABLE_ARCH_avr
116 include avr/local.mk
117 endif
118 if SIM_ENABLE_ARCH_bfin
119 include bfin/local.mk
120 endif
121 if SIM_ENABLE_ARCH_bpf
122 include bpf/local.mk
123 endif
124 if SIM_ENABLE_ARCH_cr16
125 include cr16/local.mk
126 endif
127 if SIM_ENABLE_ARCH_cris
128 include cris/local.mk
129 endif
130 if SIM_ENABLE_ARCH_d10v
131 include d10v/local.mk
132 endif
133 if SIM_ENABLE_ARCH_erc32
134 include erc32/local.mk
135 endif
136 if SIM_ENABLE_ARCH_examples
137 include example-synacor/local.mk
138 endif
139 if SIM_ENABLE_ARCH_frv
140 include frv/local.mk
141 endif
142 if SIM_ENABLE_ARCH_ft32
143 include ft32/local.mk
144 endif
145 if SIM_ENABLE_ARCH_h8300
146 include h8300/local.mk
147 endif
148 if SIM_ENABLE_ARCH_iq2000
149 include iq2000/local.mk
150 endif
151 if SIM_ENABLE_ARCH_lm32
152 include lm32/local.mk
153 endif
154 if SIM_ENABLE_ARCH_m32c
155 include m32c/local.mk
156 endif
157 if SIM_ENABLE_ARCH_m32r
158 include m32r/local.mk
159 endif
160 if SIM_ENABLE_ARCH_m68hc11
161 include m68hc11/local.mk
162 endif
163 if SIM_ENABLE_ARCH_mcore
164 include mcore/local.mk
165 endif
166 if SIM_ENABLE_ARCH_microblaze
167 include microblaze/local.mk
168 endif
169 if SIM_ENABLE_ARCH_mips
170 include mips/local.mk
171 endif
172 if SIM_ENABLE_ARCH_mn10300
173 include mn10300/local.mk
174 endif
175 if SIM_ENABLE_ARCH_moxie
176 include moxie/local.mk
177 endif
178 if SIM_ENABLE_ARCH_msp430
179 include msp430/local.mk
180 endif
181 if SIM_ENABLE_ARCH_or1k
182 include or1k/local.mk
183 endif
184 if SIM_ENABLE_ARCH_ppc
185 include ppc/local.mk
186 endif
187 if SIM_ENABLE_ARCH_pru
188 include pru/local.mk
189 endif
190 if SIM_ENABLE_ARCH_riscv
191 include riscv/local.mk
192 endif
193 if SIM_ENABLE_ARCH_rl78
194 include rl78/local.mk
195 endif
196 if SIM_ENABLE_ARCH_rx
197 include rx/local.mk
198 endif
199 if SIM_ENABLE_ARCH_sh
200 include sh/local.mk
201 endif
202 if SIM_ENABLE_ARCH_v850
203 include v850/local.mk
204 endif
205
206 ## Helper targets for running make from the top-level when some subdirs still
207 ## have Makefiles in subdirs.
208
209 all-recursive: $(SIM_ALL_RECURSIVE_DEPS)
210
211 install-data-local: installdirs $(SIM_INSTALL_DATA_LOCAL_DEPS)
212 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(libdir)
213 lib=`echo sim | sed '$(program_transform_name)'`; \
214 for d in $(SIM_ENABLED_ARCHES); do \
215 n="$$lib"; \
216 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
217 n="lib$$n.a"; \
218 $(INSTALL_DATA) $$d/libsim.a $(DESTDIR)$(libdir)/$$n || exit 1; \
219 done
220
221 install-exec-local: installdirs $(SIM_INSTALL_EXEC_LOCAL_DEPS)
222 $(AM_V_at)$(MKDIR_P) $(DESTDIR)$(bindir)
223 run=`echo run | sed '$(program_transform_name)'`; \
224 for d in $(SIM_ENABLED_ARCHES); do \
225 n="$$run"; \
226 [ "$(SIM_PRIMARY_TARGET)" = "$$d" ] || n="$$n-$$d"; \
227 $(LIBTOOL) --mode=install \
228 $(INSTALL_PROGRAM) $$d/run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) || exit 1; \
229 done
230
231 uninstall-local: $(SIM_UNINSTALL_LOCAL_DEPS)
232 rm -f $(DESTDIR)$(bindir)/run $(DESTDIR)$(libdir)/libsim.a
233 for d in $(SIM_ENABLED_ARCHES); do \
234 rm -f $(DESTDIR)$(bindir)/run-$$d $(DESTDIR)$(libdir)/libsim-$$d.a; \
235 done