]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | # Makefile fragment for common parts of all simulators. |
4a94e368 | 2 | # Copyright 1997-2022 Free Software Foundation, Inc. |
c906108c SS |
3 | # Contributed by Cygnus Support. |
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 | |
4744ac1b | 7 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 8 | # (at your option) any later version. |
4744ac1b | 9 | # |
c906108c SS |
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. | |
4744ac1b | 14 | # |
c906108c | 15 | # You should have received a copy of the GNU General Public License |
4744ac1b | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c SS |
17 | |
18 | # This Makefile fragment consists of two separate parts. | |
19 | # They are merged into the final Makefile at points denoted by | |
20 | # "## COMMON_PRE_CONFIG_FRAG" and "## COMMON_POST_CONFIG_FRAG". | |
21 | # | |
22 | # The target Makefile should look like: | |
23 | # | |
24 | #># Copyright blah blah | |
25 | #> | |
26 | #>## COMMON_PRE_CONFIG_FRAG | |
27 | #> | |
28 | #># Any overrides necessary for the SIM_FOO config vars. | |
29 | #>SIM_FOO = ... | |
30 | #> | |
31 | #>## COMMON_POST_CONFIG_FRAG | |
32 | #> | |
33 | #># Rules to build target specific .o's. | |
34 | ||
35 | ## COMMON_PRE_CONFIG_FRAG | |
36 | ||
b3408412 | 37 | srcdir = @abs_srcdir@ |
36bb57e4 | 38 | VPATH = $(srcdir):$(srccom) |
c906108c SS |
39 | srccom = $(srcdir)/../common |
40 | srcroot = $(srcdir)/../.. | |
7b064844 | 41 | srcsim = $(srcdir)/.. |
c906108c | 42 | |
36bb57e4 MF |
43 | @SIM_COMMON_BUILD_FALSE@config.status = config.status |
44 | @SIM_COMMON_BUILD_TRUE@config.status = ../config.status | |
45 | ||
7daf500d SM |
46 | include $(srcroot)/gdb/silent-rules.mk |
47 | ||
65f42b88 MF |
48 | ifeq ($(V),0) |
49 | ECHO_STAMP = @echo " GEN " | |
0eecf48f | 50 | ECHO_IGEN = @echo " IGEN $(<F)"; |
65f42b88 MF |
51 | else |
52 | ECHO_STAMP = @: | |
53 | endif | |
54 | ||
5c9e84c2 | 55 | # Helper code from gnulib. |
483ab96a MF |
56 | GNULIB_PARENT_DIR = ../.. |
57 | include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc | |
5c9e84c2 | 58 | |
3f8414df MF |
59 | # Settings from top-level configure. |
60 | include ../arch-subdir.mk | |
61 | ||
c906108c SS |
62 | prefix = @prefix@ |
63 | exec_prefix = @exec_prefix@ | |
64 | ||
c906108c SS |
65 | bindir = @bindir@ |
66 | ||
67 | libdir = @libdir@ | |
68 | tooldir = $(libdir)/$(target_alias) | |
69 | ||
70 | datadir = @datadir@ | |
1428dced | 71 | datarootdir = @datarootdir@ |
c906108c SS |
72 | mandir = @mandir@ |
73 | man1dir = $(mandir)/man1 | |
74 | infodir = @infodir@ | |
75 | includedir = @includedir@ | |
76 | ||
77 | # This can be referenced by the gettext configuration code. | |
78 | top_builddir = .. | |
79 | ||
c906108c SS |
80 | SHELL = @SHELL@ |
81 | ||
c906108c | 82 | SIM_BITSIZE = @sim_bitsize@ |
c906108c | 83 | SIM_FLOAT = @sim_float@ |
d4f3574e SS |
84 | SIM_WARN_CFLAGS = $(WARN_CFLAGS) |
85 | SIM_WERROR_CFLAGS = $(WERROR_CFLAGS) | |
c906108c | 86 | |
db2e4d67 | 87 | # Dependency tracking information. |
db2e4d67 MF |
88 | depcomp = $(SHELL) $(srcroot)/depcomp |
89 | ||
90 | # Note that these are overridden by GNU make-specific code below if | |
91 | # GNU make is used. The overrides implement dependency tracking. | |
46f900c0 | 92 | COMPILE.pre = $(CC) $(C_DIALECT) |
db2e4d67 | 93 | COMPILE.post = -c -o $@ |
7daf500d | 94 | COMPILE = $(ECHO_CC) $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post) |
db2e4d67 | 95 | POSTCOMPILE = @true |
c906108c | 96 | |
2b8d134b SM |
97 | # igen leaks memory, and therefore makes AddressSanitizer unhappy. Disable |
98 | # leak detection while running it. | |
a55b92be MF |
99 | IGEN = ../igen/igen$(EXEEXT) |
100 | IGEN_RUN = ASAN_OPTIONS=detect_leaks=0 $(IGEN) | |
2b8d134b | 101 | |
c906108c SS |
102 | # Each simulator's Makefile.in defines one or more of these variables |
103 | # to override our settings as necessary. There is no need to define these | |
104 | # in the simulator's Makefile.in if one is using the default value. In fact | |
105 | # it's preferable not to. | |
106 | ||
107 | # List of object files, less common parts. | |
108 | SIM_OBJS = | |
109 | # List of extra dependencies. | |
110 | # Generally this consists of simulator specific files included by sim-main.h. | |
111 | SIM_EXTRA_DEPS = | |
112 | # List of flags to always pass to $(CC). | |
113 | SIM_EXTRA_CFLAGS = | |
114 | # List of extra libraries to link with. | |
115 | SIM_EXTRA_LIBS = | |
c906108c | 116 | # List of main object files for `run'. |
465fb143 | 117 | SIM_RUN_OBJS = nrun.o |
c906108c SS |
118 | # Dependency of `install' to install any extra files. |
119 | SIM_EXTRA_INSTALL = | |
120 | # Dependency of `clean' to clean any extra files. | |
121 | SIM_EXTRA_CLEAN = | |
d690312f CD |
122 | # Likewise `distclean' |
123 | SIM_EXTRA_DISTCLEAN = | |
c906108c SS |
124 | |
125 | # Every time a new general purpose source file was added every target's | |
126 | # Makefile.in needed to be updated to include the file in SIM_OBJS. | |
127 | # This doesn't scale. | |
128 | # This variable specifies all the generic stuff common to the newer simulators. | |
129 | # Things like sim-reason.o can't go here as the cpu may provide its own | |
130 | # (though hopefully in time that won't be so). Things like sim-bits.o can go | |
131 | # here. Some files are used by all simulators (e.g. callback.o). | |
132 | # Those files are specified in LIB_OBJS below. | |
133 | ||
134 | SIM_COMMON_HW_OBJS = \ | |
135 | hw-alloc.o \ | |
136 | hw-base.o \ | |
137 | hw-device.o \ | |
138 | hw-events.o \ | |
139 | hw-handles.o \ | |
140 | hw-instances.o \ | |
141 | hw-ports.o \ | |
142 | hw-properties.o \ | |
143 | hw-tree.o \ | |
144 | sim-hw.o \ | |
145 | ||
146 | SIM_NEW_COMMON_OBJS = \ | |
147 | sim-arange.o \ | |
148 | sim-bits.o \ | |
6e4f085c | 149 | sim-close.o \ |
2419798b | 150 | sim-command.o \ |
c906108c SS |
151 | sim-config.o \ |
152 | sim-core.o \ | |
78e9aa70 | 153 | sim-cpu.o \ |
c906108c | 154 | sim-endian.o \ |
122bbfb5 | 155 | sim-engine.o \ |
c906108c SS |
156 | sim-events.o \ |
157 | sim-fpu.o \ | |
5e744ef8 | 158 | sim-hload.o \ |
122bbfb5 | 159 | sim-hrw.o \ |
c906108c SS |
160 | sim-io.o \ |
161 | sim-info.o \ | |
c906108c | 162 | sim-memopt.o \ |
0d585950 | 163 | sim-model.o \ |
c906108c SS |
164 | sim-module.o \ |
165 | sim-options.o \ | |
166 | sim-profile.o \ | |
797eee42 MF |
167 | sim-reason.o \ |
168 | sim-reg.o \ | |
c906108c | 169 | sim-signal.o \ |
797eee42 | 170 | sim-stop.o \ |
61a0c964 | 171 | sim-syscall.o \ |
c906108c SS |
172 | sim-trace.o \ |
173 | sim-utils.o \ | |
174 | sim-watch.o \ | |
175 | \ | |
176 | $(SIM_HW_OBJS) \ | |
177 | ||
80532737 DE |
178 | # cgen-sim.h and the headers it includes |
179 | CGEN_SIM_DEPS = \ | |
180 | $(srccom)/cgen-sim.h \ | |
c906108c | 181 | $(srccom)/cgen-defs.h \ |
c906108c | 182 | $(srccom)/cgen-scache.h \ |
80532737 DE |
183 | $(srccom)/cgen-fpu.h \ |
184 | $(srccom)/cgen-par.h \ | |
185 | $(srccom)/cgen-cpu.h \ | |
c906108c | 186 | $(srccom)/cgen-trace.h \ |
80532737 DE |
187 | cpuall.h |
188 | ||
189 | # Add this to SIM_EXTRA_DEPS. | |
190 | CGEN_INCLUDE_DEPS = \ | |
191 | $(CGEN_SIM_DEPS) \ | |
192 | $(srccom)/cgen-engine.h \ | |
c906108c SS |
193 | $(srccom)/cgen-types.h \ |
194 | $(srcdir)/../../include/opcode/cgen.h | |
195 | ||
196 | ## End COMMON_PRE_CONFIG_FRAG | |
197 | ||
198 | ## COMMON_POST_CONFIG_FRAG | |
199 | ||
200 | CONFIG_CFLAGS = \ | |
52d37d2c | 201 | -DHAVE_CONFIG_H \ |
c906108c | 202 | $(SIM_BITSIZE) \ |
c906108c SS |
203 | $(SIM_FLOAT) \ |
204 | $(SIM_HW_CFLAGS) \ | |
c906108c | 205 | $(SIM_INLINE) \ |
d4f3574e SS |
206 | $(SIM_WARN_CFLAGS) \ |
207 | $(SIM_WERROR_CFLAGS) \ | |
10737236 | 208 | $(SIM_HARDWARE) |
c906108c SS |
209 | CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \ |
210 | -I../../include -I$(srcroot)/include \ | |
211 | -I../../bfd -I$(srcroot)/bfd \ | |
212 | -I../../opcodes -I$(srcroot)/opcodes \ | |
5c9e84c2 | 213 | -I../.. \ |
ce3ec98a | 214 | $(INTL_CFLAGS) |
5c9e84c2 | 215 | ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(INCGNU) $(SIM_EXTRA_CFLAGS) $(CFLAGS) |
c2783492 | 216 | BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(CSEARCH) |
c906108c | 217 | |
10737236 | 218 | COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(SIM_EXTRA_CFLAGS) |
c906108c | 219 | |
be0387ee | 220 | SIM_HW_DEVICES = cfi core pal glue $(SIM_EXTRA_HW_DEVICES) |
be0387ee | 221 | |
b5689863 | 222 | ZLIB = $(zlibdir) -lz |
c906108c | 223 | LIBIBERTY_LIB = ../../libiberty/libiberty.a |
79730a3b | 224 | BFD_LIB = ../../bfd/libbfd.a |
c906108c | 225 | OPCODES_LIB = ../../opcodes/libopcodes.a |
07490bf8 | 226 | CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB) |
ed30adf7 | 227 | LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB) |
20e95c23 | 228 | EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \ |
b25370aa | 229 | $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS) |
c906108c | 230 | |
dd8e16ea | 231 | COMMON_OBJS_NAMES = \ |
cd3ee89d | 232 | callback.o \ |
ad9cc209 | 233 | portability.o \ |
dd8e16ea | 234 | sim-load.o \ |
66882204 | 235 | syscall.o \ |
a7e40a99 | 236 | target-newlib-errno.o \ |
670817b9 | 237 | target-newlib-open.o \ |
88c8370b | 238 | target-newlib-signal.o \ |
1e42d017 | 239 | target-newlib-syscall.o \ |
dd8e16ea MF |
240 | version.o |
241 | COMMON_OBJS = $(COMMON_OBJS_NAMES:%=../common/common_libcommon_a-%) | |
5bea0c32 | 242 | |
66882204 | 243 | LIB_OBJS = modules.o $(COMMON_OBJS) $(SIM_OBJS) |
64ae70dd | 244 | |
c6c7769d | 245 | COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) |
e7d9022b | 246 | LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@ |
c6c7769d | 247 | |
c906108c SS |
248 | RUNTESTFLAGS = |
249 | ||
df68e12b MF |
250 | callback_h = $(srcroot)/include/sim/callback.h |
251 | remote_sim_h = $(srcroot)/include/sim/sim.h | |
3c25f8c7 | 252 | |
21672298 | 253 | all: libsim.a run$(EXEEXT) |
c906108c SS |
254 | |
255 | libsim.a: $(LIB_OBJS) | |
65f42b88 | 256 | $(SILENCE) rm -f libsim.a |
7daf500d SM |
257 | $(ECHO_AR) $(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS) |
258 | $(ECHO_RANLIB) $(RANLIB) libsim.a | |
c906108c | 259 | |
4ec242d7 | 260 | run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS) |
7daf500d | 261 | $(ECHO_CCLD) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \ |
c906108c SS |
262 | $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS) |
263 | ||
c906108c SS |
264 | # |
265 | # Rules for building sim-* components. Triggered by listing the corresponding | |
266 | # .o file in the list of simulator targets. | |
267 | # | |
268 | ||
269 | sim_main_headers = \ | |
270 | sim-main.h \ | |
08cd3760 RE |
271 | $(sim-assert_h) \ |
272 | $(sim-base_h) \ | |
273 | $(sim-cpu_h) \ | |
274 | $(sim-engine_h) \ | |
275 | $(sim-events_h) \ | |
276 | $(sim-memopt_h) \ | |
277 | $(sim-model_h) \ | |
278 | $(sim-module_h) \ | |
279 | $(sim-profile_h) \ | |
280 | $(sim-trace_h) \ | |
281 | $(sim-watch_h) \ | |
282 | $(sim-basics_h) \ | |
c906108c SS |
283 | $(SIM_EXTRA_DEPS) |
284 | ||
285 | # Exported version of sim_main_headers. | |
286 | SIM_MAIN_DEPS = \ | |
287 | $(sim_main_headers) | |
288 | ||
08cd3760 | 289 | sim-alu_h = $(srccom)/sim-alu.h |
ef986697 | 290 | sim-arange_h = $(srccom)/sim-arange.h |
c906108c | 291 | sim-assert_h = $(srccom)/sim-assert.h |
08cd3760 RE |
292 | sim-base_h = $(srccom)/sim-base.h \ |
293 | $(sim-module_h) \ | |
294 | $(sim-trace_h) \ | |
295 | $(sim-core_h) \ | |
296 | $(sim-events_h) \ | |
297 | $(sim-profile_h) \ | |
298 | $(sim-model_h) \ | |
299 | $(sim-io_h) \ | |
300 | $(sim-engine_h) \ | |
301 | $(sim-watch_h) \ | |
302 | $(sim-memopt_h) \ | |
303 | $(sim-cpu_h) | |
304 | sim-basics_h = $(srccom)/sim-basics.h \ | |
08cd3760 | 305 | $(sim-config_h) \ |
70ae6611 | 306 | $(callback_h) \ |
08cd3760 RE |
307 | $(sim-inline_h) \ |
308 | $(sim-types_h) \ | |
309 | $(sim-bits_h) \ | |
310 | $(sim-endian_h) \ | |
311 | $(sim-signal_h) \ | |
312 | $(sim-arange_h) \ | |
313 | $(sim-utils_h) | |
314 | sim-bits_h = $(srccom)/sim-bits.h \ | |
315 | $(srccom)/sim-bits.c | |
c906108c | 316 | sim-config_h = $(srccom)/sim-config.h |
c906108c | 317 | sim-core_h = $(srccom)/sim-core.h |
08cd3760 RE |
318 | sim-cpu_h = $(srccom)/sim-cpu.h |
319 | sim-endian_h = $(srccom)/sim-endian.h \ | |
320 | $(srccom)/sim-endian.c | |
c906108c SS |
321 | sim-engine_h = $(srccom)/sim-engine.h |
322 | sim-events_h = $(srccom)/sim-events.h | |
323 | sim-fpu_h = $(srccom)/sim-fpu.h | |
08cd3760 RE |
324 | sim-hw_h = $(srccom)/sim-hw.h |
325 | sim-inline_h = $(srccom)/sim-inline.h | |
c906108c | 326 | sim-io_h = $(srccom)/sim-io.h |
08cd3760 RE |
327 | sim-memopt_h = $(srccom)/sim-memopt.h |
328 | sim-model_h = $(srccom)/sim-model.h | |
329 | sim-module_h = $(srccom)/sim-module.h | |
330 | sim-n-bits_h = $(srccom)/sim-n-bits.h | |
331 | sim-n-core_h = $(srccom)/sim-n-core.h | |
332 | sim-n-endian_h = $(srccom)/sim-n-endian.h | |
c906108c | 333 | sim-options_h = $(srccom)/sim-options.h |
08cd3760 | 334 | sim-profile_h = $(srccom)/sim-profile.h |
c906108c | 335 | sim-signal_h = $(srccom)/sim-signal.h |
08cd3760 RE |
336 | sim-trace_h = $(srccom)/sim-trace.h |
337 | sim-types_h = $(srccom)/sim-types.h | |
338 | sim-utils_h = $(srccom)/sim-utils.h | |
339 | sim-watch_h = $(srccom)/sim-watch.h | |
c906108c SS |
340 | |
341 | hw-alloc_h = $(srccom)/hw-alloc.h | |
342 | hw-base_h = $(srccom)/hw-base.h | |
343 | hw-device_h = $(srccom)/hw-device.h | |
344 | hw-events_h = $(srccom)/hw-events.h | |
345 | hw-handles_h = $(srccom)/hw-handles.h | |
346 | hw-instances_h = $(srccom)/hw-instances.h | |
347 | hw-ports_h = $(srccom)/hw-ports.h | |
348 | hw-properties_h = $(srccom)/hw-properties.h | |
349 | hw-tree_h = $(srccom)/hw-tree.h | |
350 | ||
351 | hw_main_headers = \ | |
352 | $(srccom)/hw-main.h \ | |
353 | $(hw-alloc_h) \ | |
354 | $(hw-base_h) \ | |
355 | $(hw-device_h) \ | |
356 | $(hw-events_h) \ | |
357 | $(hw-instances_h) \ | |
358 | $(hw-handles_h) \ | |
359 | $(hw-ports_h) \ | |
360 | $(hw-properties_h) \ | |
361 | ||
db2e4d67 MF |
362 | # |
363 | # Dependency tracking. Most of this is conditional on GNU Make being | |
364 | # found by configure; if GNU Make is not found, we fall back to a | |
365 | # simpler scheme. | |
366 | # | |
367 | ||
efd82ac7 | 368 | ifeq ($(DEPMODE),depmode=gcc3) |
db2e4d67 MF |
369 | # Note that we put the dependencies into a .Tpo file, then move them |
370 | # into place if the compile succeeds. We need this because gcc does | |
371 | # not atomically write the dependency output file. | |
efd82ac7 TT |
372 | override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \ |
373 | -MF $(DEPDIR)/$(basename $(@F)).Tpo | |
374 | override POSTCOMPILE = @mv $(DEPDIR)/$(basename $(@F)).Tpo \ | |
375 | $(DEPDIR)/$(basename $(@F)).Po | |
376 | else | |
377 | override COMPILE.pre = source='$<' object='$@' libtool=no \ | |
378 | DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) $(CC) | |
db2e4d67 MF |
379 | # depcomp handles atomicity for us, so we don't need a postcompile |
380 | # step. | |
efd82ac7 TT |
381 | override POSTCOMPILE = |
382 | endif | |
db2e4d67 MF |
383 | |
384 | all_object_files = $(LIB_OBJS) $(SIM_RUN_OBJS) | |
385 | generated_files = \ | |
386 | $(SIM_EXTRA_DEPS) \ | |
387 | hw-config.h \ | |
1e42d017 | 388 | modules.c |
db2e4d67 MF |
389 | |
390 | # Ensure that generated files are created early. Use order-only | |
391 | # dependencies if available. They require GNU make 3.80 or newer, | |
392 | # and the .VARIABLES variable was introduced at the same time. | |
efd82ac7 TT |
393 | ifdef .VARIABLES |
394 | $(all_object_files): | $(generated_files) | |
395 | else | |
db2e4d67 | 396 | $(all_object_files) : $(generated_files) |
efd82ac7 | 397 | endif |
db2e4d67 MF |
398 | |
399 | # Dependencies. | |
efd82ac7 | 400 | -include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files)) |
c906108c | 401 | |
c906108c | 402 | # FIXME This is one very simple-minded way of generating the file hw-config.h |
b396d3a1 | 403 | hw-config.h: stamp-hw ; @true |
36bb57e4 | 404 | stamp-hw: Makefile.in $(srccom)/Make-common.in $(config.status) Makefile |
65f42b88 MF |
405 | $(ECHO_STAMP) hw-config.h |
406 | $(SILENCE) ( \ | |
407 | sim_hw="$(SIM_HW_DEVICES)" ; \ | |
408 | echo "/* generated by Makefile */" ; \ | |
409 | printf "extern const struct hw_descriptor dv_%s_descriptor[];\n" $$sim_hw ; \ | |
d9a84d15 | 410 | echo "const struct hw_descriptor * const hw_descriptors[] = {" ; \ |
65f42b88 MF |
411 | printf " dv_%s_descriptor,\n" $$sim_hw ; \ |
412 | echo " NULL," ; \ | |
413 | echo "};" \ | |
414 | ) > tmp-hw.h | |
4f2b181e | 415 | $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-hw.h hw-config.h |
b6143d31 | 416 | $(SILENCE) touch $@ |
c906108c | 417 | |
c906108c SS |
418 | test-hw-events: $(srccom)/hw-events.c libsim.a |
419 | $(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \ | |
420 | $(srccom)/hw-events.c libsim.a $(EXTRA_LIBS) | |
421 | ||
8e5f1516 | 422 | # See sim_pre_argv_init and sim_module_install in sim-module.c for more details. |
015f7b74 MF |
423 | modules.c: stamp-modules ; @true |
424 | stamp-modules: Makefile $(SIM_OBJS:.o=.c) | |
65f42b88 MF |
425 | $(ECHO_STAMP) modules.c |
426 | $(SILENCE) LANG=C ; export LANG ; \ | |
8e5f1516 MF |
427 | LC_ALL=C ; export LC_ALL ; \ |
428 | sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $^ | sort >$@.l-tmp | |
429 | @set -e; (\ | |
430 | echo '/* Do not modify this file. */'; \ | |
431 | echo '/* It is created automatically by the Makefile. */'; \ | |
432 | echo '#include "libiberty.h"'; \ | |
433 | echo '#include "sim-module.h"'; \ | |
cee4c731 | 434 | sed -e 's:\(.*\):extern MODULE_INIT_FN \1;:' $@.l-tmp; \ |
8e5f1516 MF |
435 | echo 'MODULE_INSTALL_FN * const sim_modules_detected[] = {'; \ |
436 | sed -e 's:\(.*\): \1,:' $@.l-tmp; \ | |
437 | echo '};'; \ | |
438 | echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \ | |
439 | ) >$@.tmp | |
4f2b181e | 440 | $(SILENCE) $(SHELL) $(srcroot)/move-if-change $@.tmp modules.c |
65f42b88 | 441 | $(SILENCE) rm -f $@.l-tmp $@.tmp |
b6143d31 | 442 | $(SILENCE) touch $@ |
8e5f1516 | 443 | |
c906108c SS |
444 | # CGEN support. |
445 | ||
446 | # For use in Makefile.in for cpu-specific files. | |
447 | CGEN_MAIN_CPU_DEPS = \ | |
448 | $(SIM_MAIN_DEPS) \ | |
c906108c | 449 | $(srccom)/cgen-ops.h \ |
80532737 | 450 | $(srccom)/cgen-mem.h |
c906108c | 451 | |
c906108c SS |
452 | # Support targets. |
453 | ||
454 | install: install-common $(SIM_EXTRA_INSTALL) | |
455 | ||
456 | install-common: installdirs | |
a0e674c1 | 457 | a=`basename "$$(pwd)"`; \ |
c906108c | 458 | n=`echo run | sed '$(program_transform_name)'`; \ |
a0e674c1 | 459 | [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \ |
149cfe5b | 460 | $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT) |
fccf4ba5 | 461 | n=`echo sim | sed '$(program_transform_name)'`; \ |
a0e674c1 MF |
462 | a=`basename "$$(pwd)"`; \ |
463 | [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \ | |
464 | n="lib$$n.a"; \ | |
149cfe5b DJ |
465 | $(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \ |
466 | ( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n ) | |
c906108c SS |
467 | |
468 | installdirs: | |
149cfe5b DJ |
469 | $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir) |
470 | $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir) | |
c906108c SS |
471 | |
472 | check: | |
c906108c | 473 | |
0d0878d7 MF |
474 | html: |
475 | clean-html: | |
476 | install-html: | |
477 | ||
c906108c SS |
478 | info: |
479 | clean-info: | |
480 | install-info: | |
481 | ||
0d0878d7 MF |
482 | pdf: |
483 | clean-pdf: | |
484 | install-pdf: | |
485 | ||
c906108c SS |
486 | .NOEXPORT: |
487 | MAKEOVERRIDES= | |
488 | ||
489 | tags etags: TAGS | |
490 | ||
491 | # Macros like EXTERN_SIM_CORE confuse tags. | |
492 | # And the sim-n-foo.h files create functions that can't be found either. | |
493 | TAGS: force | |
494 | cd $(srcdir) && \ | |
509deab2 | 495 | etags --regex '/^\([[:lower:]_]+\) (/\1/' --regex '/^\/[*] TAGS: .*/' \ |
c906108c SS |
496 | *.[ch] ../common/*.[ch] |
497 | ||
be866656 | 498 | mostlyclean clean: $(SIM_EXTRA_CLEAN) |
2213e33d MF |
499 | rm -f *.[oa] *~ core \ |
500 | run$(EXEEXT) libsim.a \ | |
501 | hw-config.h stamp-hw \ | |
502 | modules.c stamp-modules \ | |
2213e33d | 503 | tmp-mloop.hin tmp-mloop.h tmp-mloop.cin tmp-mloop.c |
c906108c | 504 | |
be866656 | 505 | distclean maintainer-clean realclean: clean $(SIM_EXTRA_DISTCLEAN) |
c906108c | 506 | rm -f TAGS |
21672298 | 507 | rm -f Makefile config.cache config.log config.status |
c906108c SS |
508 | |
509 | .c.o: | |
db2e4d67 MF |
510 | $(COMPILE) $< |
511 | $(POSTCOMPILE) | |
c906108c SS |
512 | |
513 | # Dummy target to force execution of dependent targets. | |
514 | force: | |
515 | ||
36bb57e4 | 516 | Makefile: Makefile.in $(srccom)/Make-common.in $(config.status) |
9709fa5b MF |
517 | @SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) CONFIG_HEADERS= $(SHELL) ./config.status |
518 | @SIM_COMMON_BUILD_TRUE@ $(ECHO_GEN) pwd=`pwd` && subdir=`basename "$$pwd"` && cd .. && \ | |
cc717561 | 519 | @SIM_COMMON_BUILD_TRUE@ $(SHELL) ./config.status Make-common.sim $$subdir/Makefile.sim $$subdir/Makefile |
c906108c | 520 | |
36bb57e4 | 521 | @SIM_COMMON_BUILD_FALSE@config.status: configure |
9709fa5b | 522 | @SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) $(SHELL) ./config.status --recheck |
c906108c | 523 | |
c906108c | 524 | |
604259a0 FCE |
525 | # CGEN support |
526 | ||
2fe36d31 MF |
527 | GUILE = `if [ -f ../../guile/libguile/guile ]; then echo ../../guile/libguile/guile; else echo guile ; fi` |
528 | CGEN = "$(GUILE) -l $(CGENDIR)/guile.scm -s" | |
604259a0 | 529 | CGENFLAGS = -v |
e3e473da | 530 | CGEN_CPU_DIR = $(CGENDIR)/cpu |
604259a0 | 531 | |
6a8b8615 DE |
532 | # Most ports use the files here instead of cgen/cpu. |
533 | CPU_DIR = $(srcroot)/cpu | |
534 | ||
7ede505a | 535 | CGEN_READ_SCM = $(CGENDIR)/sim.scm |
e3e473da BE |
536 | CGEN_ARCH_SCM = $(CGENDIR)/sim-arch.scm |
537 | CGEN_CPU_SCM = $(CGENDIR)/sim-cpu.scm $(CGENDIR)/sim-model.scm | |
538 | CGEN_DECODE_SCM = $(CGENDIR)/sim-decode.scm | |
539 | CGEN_DESC_SCM = $(CGENDIR)/desc.scm $(CGENDIR)/desc-cpu.scm | |
604259a0 FCE |
540 | |
541 | # Various choices for which cpu specific files to generate. | |
2c2a86d7 DE |
542 | # These are passed to cgen.sh in the "extrafiles" argument. |
543 | CGEN_CPU_EXTR = /extr/ | |
544 | CGEN_CPU_READ = /read/ | |
545 | CGEN_CPU_WRITE = /write/ | |
546 | CGEN_CPU_SEM = /sem/ | |
547 | CGEN_CPU_SEMSW = /semsw/ | |
604259a0 FCE |
548 | |
549 | CGEN_FLAGS_TO_PASS = \ | |
9ab46d53 | 550 | CGEN='$(CGEN)' \ |
604259a0 FCE |
551 | CGENFLAGS="$(CGENFLAGS)" |
552 | ||
553 | # We store the generated files in the source directory until we decide to | |
554 | # ship a Scheme interpreter with gdb/binutils. Maybe we never will. | |
555 | ||
556 | cgen-arch: force | |
557 | $(SHELL) $(srccom)/cgen.sh arch $(srcdir) \ | |
558 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 DB |
559 | $(arch) "$(FLAGS)" ignored "$(isa)" $(mach) ignored \ |
560 | $(archfile) ignored | |
3c25f8c7 | 561 | |
604259a0 FCE |
562 | cgen-cpu: force |
563 | $(SHELL) $(srccom)/cgen.sh cpu $(srcdir) \ | |
564 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 DB |
565 | $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \ |
566 | $(archfile) "$(EXTRAFILES)" | |
604259a0 | 567 | |
c79688eb BE |
568 | cgen-defs: force |
569 | $(SHELL) $(srccom)/cgen.sh defs $(srcdir) \ | |
570 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 DB |
571 | $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \ |
572 | $(archfile) ignored | |
c79688eb | 573 | |
604259a0 FCE |
574 | cgen-decode: force |
575 | $(SHELL) $(srccom)/cgen.sh decode $(srcdir) \ | |
576 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 DB |
577 | $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \ |
578 | $(archfile) "$(EXTRAFILES)" | |
604259a0 FCE |
579 | |
580 | cgen-cpu-decode: force | |
581 | $(SHELL) $(srccom)/cgen.sh cpu-decode $(srcdir) \ | |
582 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 DB |
583 | $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \ |
584 | $(archfile) "$(EXTRAFILES)" | |
604259a0 FCE |
585 | |
586 | cgen-desc: force | |
587 | $(SHELL) $(srccom)/cgen.sh desc $(srcdir) \ | |
588 | $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \ | |
ea52ff81 | 589 | $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \ |
ad6e5d2e | 590 | $(archfile) ignored $(opcfile) |
604259a0 | 591 | |
c906108c | 592 | ## End COMMON_POST_CONFIG_FRAG |