]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/common/Make-common.in
sim: frv: resolve syscalls dynamically
[thirdparty/binutils-gdb.git] / sim / common / Make-common.in
CommitLineData
c906108c 1# Makefile fragment for common parts of all simulators.
3666a048 2# Copyright 1997-2021 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 37srcdir = @abs_srcdir@
36bb57e4 38VPATH = $(srcdir):$(srccom)
c906108c
SS
39srccom = $(srcdir)/../common
40srcroot = $(srcdir)/../..
7b064844 41srcsim = $(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
46include $(srcroot)/gdb/silent-rules.mk
47
65f42b88
MF
48ifeq ($(V),0)
49ECHO_STAMP = @echo " GEN "
0eecf48f 50ECHO_IGEN = @echo " IGEN $(<F)";
65f42b88
MF
51else
52ECHO_STAMP = @:
53endif
54
5c9e84c2 55# Helper code from gnulib.
483ab96a
MF
56GNULIB_PARENT_DIR = ../..
57include $(GNULIB_PARENT_DIR)/gnulib/Makefile.gnulib.inc
5c9e84c2 58
3f8414df
MF
59# Settings from top-level configure.
60include ../arch-subdir.mk
61
c906108c
SS
62prefix = @prefix@
63exec_prefix = @exec_prefix@
64
c906108c
SS
65bindir = @bindir@
66
67libdir = @libdir@
68tooldir = $(libdir)/$(target_alias)
69
70datadir = @datadir@
1428dced 71datarootdir = @datarootdir@
c906108c
SS
72mandir = @mandir@
73man1dir = $(mandir)/man1
74infodir = @infodir@
75includedir = @includedir@
76
77# This can be referenced by the gettext configuration code.
78top_builddir = ..
79
c906108c
SS
80SHELL = @SHELL@
81
c906108c 82SIM_BITSIZE = @sim_bitsize@
c906108c 83SIM_FLOAT = @sim_float@
d4f3574e
SS
84SIM_WARN_CFLAGS = $(WARN_CFLAGS)
85SIM_WERROR_CFLAGS = $(WERROR_CFLAGS)
c906108c 86
db2e4d67 87# Dependency tracking information.
db2e4d67
MF
88depcomp = $(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 92COMPILE.pre = $(CC) $(C_DIALECT)
db2e4d67 93COMPILE.post = -c -o $@
7daf500d 94COMPILE = $(ECHO_CC) $(COMPILE.pre) $(ALL_CFLAGS) $(COMPILE.post)
db2e4d67 95POSTCOMPILE = @true
c906108c 96
2b8d134b
SM
97# igen leaks memory, and therefore makes AddressSanitizer unhappy. Disable
98# leak detection while running it.
a55b92be
MF
99IGEN = ../igen/igen$(EXEEXT)
100IGEN_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.
108SIM_OBJS =
109# List of extra dependencies.
110# Generally this consists of simulator specific files included by sim-main.h.
111SIM_EXTRA_DEPS =
112# List of flags to always pass to $(CC).
113SIM_EXTRA_CFLAGS =
114# List of extra libraries to link with.
115SIM_EXTRA_LIBS =
c906108c 116# List of main object files for `run'.
465fb143 117SIM_RUN_OBJS = nrun.o
c906108c
SS
118# Dependency of `install' to install any extra files.
119SIM_EXTRA_INSTALL =
120# Dependency of `clean' to clean any extra files.
121SIM_EXTRA_CLEAN =
d690312f
CD
122# Likewise `distclean'
123SIM_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
134SIM_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
146SIM_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
179CGEN_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.
190CGEN_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
200CONFIG_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
209CSEARCH = -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 215ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(INCGNU) $(SIM_EXTRA_CFLAGS) $(CFLAGS)
c2783492 216BUILD_CFLAGS = $(CFLAGS_FOR_BUILD) $(CSEARCH)
c906108c 217
10737236 218COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(SIM_EXTRA_CFLAGS)
c906108c 219
be0387ee 220SIM_HW_DEVICES = cfi core pal glue $(SIM_EXTRA_HW_DEVICES)
be0387ee 221
b5689863 222ZLIB = $(zlibdir) -lz
c906108c 223LIBIBERTY_LIB = ../../libiberty/libiberty.a
79730a3b 224BFD_LIB = ../../bfd/libbfd.a
c906108c 225OPCODES_LIB = ../../opcodes/libopcodes.a
07490bf8 226CONFIG_LIBS = $(COMMON_LIBS) @LIBS@ $(ZLIB)
ed30adf7 227LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL_DEP) $(LIBIBERTY_LIB)
20e95c23 228EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBINTL) $(LIBIBERTY_LIB) \
b25370aa 229 $(CONFIG_LIBS) $(SIM_EXTRA_LIBS) $(LIBDL) $(LIBGNU) $(LIBGNU_EXTRA_LIBS)
c906108c 230
dd8e16ea 231COMMON_OBJS_NAMES = \
cd3ee89d 232 callback.o \
ad9cc209 233 portability.o \
dd8e16ea 234 sim-load.o \
a7e40a99 235 target-newlib-errno.o \
670817b9 236 target-newlib-open.o \
88c8370b 237 target-newlib-signal.o \
dd8e16ea
MF
238 version.o
239COMMON_OBJS = $(COMMON_OBJS_NAMES:%=../common/common_libcommon_a-%)
5bea0c32 240
cd3ee89d 241LIB_OBJS = modules.o syscall.o targ-map.o $(COMMON_OBJS) $(SIM_OBJS)
c906108c 242
c6c7769d 243COMPILE_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS)
e7d9022b 244LINK_FOR_BUILD = $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(LDFLAGS_FOR_BUILD) -o $@
c6c7769d 245
c906108c
SS
246RUNTESTFLAGS =
247
df68e12b
MF
248callback_h = $(srcroot)/include/sim/callback.h
249remote_sim_h = $(srcroot)/include/sim/sim.h
3c25f8c7 250
f8069d55 251all: libsim.a run$(EXEEXT) .gdbinit
c906108c
SS
252
253libsim.a: $(LIB_OBJS)
65f42b88 254 $(SILENCE) rm -f libsim.a
7daf500d
SM
255 $(ECHO_AR) $(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
256 $(ECHO_RANLIB) $(RANLIB) libsim.a
c906108c 257
4ec242d7 258run$(EXEEXT): $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
7daf500d 259 $(ECHO_CCLD) $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o run$(EXEEXT) \
c906108c
SS
260 $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
261
c906108c
SS
262# FIXME: Ideally, callback.o and friends live in a library outside of
263# both the gdb and simulator source trees (e.g. devo/remote. Not
264# devo/libremote because this directory would contain more than just
265# a library).
266
c6c7769d 267gentmap.o: Makefile $(srccom)/gentmap.c $(srccom)/nltvals.def
7daf500d 268 $(ECHO_CC) $(COMPILE_FOR_BUILD) -o $@ -c $(srccom)/gentmap.c $(NL_TARGET)
c6c7769d
MF
269
270gentmap: gentmap.o
7daf500d 271 $(ECHO_CC) $(LINK_FOR_BUILD) $<
c906108c
SS
272
273targ-vals.h targ-map.c: stamp-tvals
274stamp-tvals: gentmap
65f42b88
MF
275 $(ECHO_STAMP) targ-vals.h
276 $(SILENCE) ./gentmap -h >tmp-tvals.h
4f2b181e 277 $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-tvals.h targ-vals.h
65f42b88
MF
278 $(ECHO_STAMP) targ-tmap.c
279 $(SILENCE) ./gentmap -c >tmp-tmap.c
4f2b181e 280 $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-tmap.c targ-map.c
b6143d31 281 $(SILENCE) touch $@
c906108c
SS
282
283#
284# Rules for building sim-* components. Triggered by listing the corresponding
285# .o file in the list of simulator targets.
286#
287
288sim_main_headers = \
289 sim-main.h \
08cd3760
RE
290 $(sim-assert_h) \
291 $(sim-base_h) \
292 $(sim-cpu_h) \
293 $(sim-engine_h) \
294 $(sim-events_h) \
295 $(sim-memopt_h) \
296 $(sim-model_h) \
297 $(sim-module_h) \
298 $(sim-profile_h) \
299 $(sim-trace_h) \
300 $(sim-watch_h) \
301 $(sim-basics_h) \
c906108c
SS
302 $(SIM_EXTRA_DEPS)
303
304# Exported version of sim_main_headers.
305SIM_MAIN_DEPS = \
306 $(sim_main_headers)
307
08cd3760 308sim-alu_h = $(srccom)/sim-alu.h
ef986697 309sim-arange_h = $(srccom)/sim-arange.h
c906108c 310sim-assert_h = $(srccom)/sim-assert.h
08cd3760
RE
311sim-base_h = $(srccom)/sim-base.h \
312 $(sim-module_h) \
313 $(sim-trace_h) \
314 $(sim-core_h) \
315 $(sim-events_h) \
316 $(sim-profile_h) \
317 $(sim-model_h) \
318 $(sim-io_h) \
319 $(sim-engine_h) \
320 $(sim-watch_h) \
321 $(sim-memopt_h) \
322 $(sim-cpu_h)
323sim-basics_h = $(srccom)/sim-basics.h \
08cd3760 324 $(sim-config_h) \
70ae6611 325 $(callback_h) \
08cd3760
RE
326 $(sim-inline_h) \
327 $(sim-types_h) \
328 $(sim-bits_h) \
329 $(sim-endian_h) \
330 $(sim-signal_h) \
331 $(sim-arange_h) \
332 $(sim-utils_h)
333sim-bits_h = $(srccom)/sim-bits.h \
334 $(srccom)/sim-bits.c
c906108c 335sim-config_h = $(srccom)/sim-config.h
c906108c 336sim-core_h = $(srccom)/sim-core.h
08cd3760
RE
337sim-cpu_h = $(srccom)/sim-cpu.h
338sim-endian_h = $(srccom)/sim-endian.h \
339 $(srccom)/sim-endian.c
c906108c
SS
340sim-engine_h = $(srccom)/sim-engine.h
341sim-events_h = $(srccom)/sim-events.h
342sim-fpu_h = $(srccom)/sim-fpu.h
08cd3760
RE
343sim-hw_h = $(srccom)/sim-hw.h
344sim-inline_h = $(srccom)/sim-inline.h
c906108c 345sim-io_h = $(srccom)/sim-io.h
08cd3760
RE
346sim-memopt_h = $(srccom)/sim-memopt.h
347sim-model_h = $(srccom)/sim-model.h
348sim-module_h = $(srccom)/sim-module.h
349sim-n-bits_h = $(srccom)/sim-n-bits.h
350sim-n-core_h = $(srccom)/sim-n-core.h
351sim-n-endian_h = $(srccom)/sim-n-endian.h
c906108c 352sim-options_h = $(srccom)/sim-options.h
08cd3760 353sim-profile_h = $(srccom)/sim-profile.h
c906108c 354sim-signal_h = $(srccom)/sim-signal.h
08cd3760
RE
355sim-trace_h = $(srccom)/sim-trace.h
356sim-types_h = $(srccom)/sim-types.h
357sim-utils_h = $(srccom)/sim-utils.h
358sim-watch_h = $(srccom)/sim-watch.h
c906108c
SS
359
360hw-alloc_h = $(srccom)/hw-alloc.h
361hw-base_h = $(srccom)/hw-base.h
362hw-device_h = $(srccom)/hw-device.h
363hw-events_h = $(srccom)/hw-events.h
364hw-handles_h = $(srccom)/hw-handles.h
365hw-instances_h = $(srccom)/hw-instances.h
366hw-ports_h = $(srccom)/hw-ports.h
367hw-properties_h = $(srccom)/hw-properties.h
368hw-tree_h = $(srccom)/hw-tree.h
369
370hw_main_headers = \
371 $(srccom)/hw-main.h \
372 $(hw-alloc_h) \
373 $(hw-base_h) \
374 $(hw-device_h) \
375 $(hw-events_h) \
376 $(hw-instances_h) \
377 $(hw-handles_h) \
378 $(hw-ports_h) \
379 $(hw-properties_h) \
380
db2e4d67
MF
381#
382# Dependency tracking. Most of this is conditional on GNU Make being
383# found by configure; if GNU Make is not found, we fall back to a
384# simpler scheme.
385#
386
efd82ac7 387ifeq ($(DEPMODE),depmode=gcc3)
db2e4d67
MF
388# Note that we put the dependencies into a .Tpo file, then move them
389# into place if the compile succeeds. We need this because gcc does
390# not atomically write the dependency output file.
efd82ac7
TT
391override COMPILE.post = -c -o $@ -MT $@ -MMD -MP \
392 -MF $(DEPDIR)/$(basename $(@F)).Tpo
393override POSTCOMPILE = @mv $(DEPDIR)/$(basename $(@F)).Tpo \
394 $(DEPDIR)/$(basename $(@F)).Po
395else
396override COMPILE.pre = source='$<' object='$@' libtool=no \
397 DEPDIR=$(DEPDIR) $(DEPMODE) $(depcomp) $(CC)
db2e4d67
MF
398# depcomp handles atomicity for us, so we don't need a postcompile
399# step.
efd82ac7
TT
400override POSTCOMPILE =
401endif
db2e4d67
MF
402
403all_object_files = $(LIB_OBJS) $(SIM_RUN_OBJS)
404generated_files = \
405 $(SIM_EXTRA_DEPS) \
406 hw-config.h \
8e5f1516 407 modules.c \
db2e4d67 408 targ-map.c \
5bea0c32 409 targ-vals.h
db2e4d67
MF
410
411# Ensure that generated files are created early. Use order-only
412# dependencies if available. They require GNU make 3.80 or newer,
413# and the .VARIABLES variable was introduced at the same time.
efd82ac7
TT
414ifdef .VARIABLES
415$(all_object_files): | $(generated_files)
416else
db2e4d67 417$(all_object_files) : $(generated_files)
efd82ac7 418endif
db2e4d67
MF
419
420# Dependencies.
efd82ac7 421-include $(patsubst %.o, $(DEPDIR)/%.Po, $(all_object_files))
c906108c 422
c906108c 423# FIXME This is one very simple-minded way of generating the file hw-config.h
b396d3a1 424hw-config.h: stamp-hw ; @true
36bb57e4 425stamp-hw: Makefile.in $(srccom)/Make-common.in $(config.status) Makefile
65f42b88
MF
426 $(ECHO_STAMP) hw-config.h
427 $(SILENCE) ( \
428 sim_hw="$(SIM_HW_DEVICES)" ; \
429 echo "/* generated by Makefile */" ; \
430 printf "extern const struct hw_descriptor dv_%s_descriptor[];\n" $$sim_hw ; \
d9a84d15 431 echo "const struct hw_descriptor * const hw_descriptors[] = {" ; \
65f42b88
MF
432 printf " dv_%s_descriptor,\n" $$sim_hw ; \
433 echo " NULL," ; \
434 echo "};" \
435 ) > tmp-hw.h
4f2b181e 436 $(SILENCE) $(SHELL) $(srcroot)/move-if-change tmp-hw.h hw-config.h
b6143d31 437 $(SILENCE) touch $@
c906108c 438
c906108c
SS
439test-hw-events: $(srccom)/hw-events.c libsim.a
440 $(CC) $(ALL_CFLAGS) -DMAIN -o test-hw-events$(EXEEXT) \
441 $(srccom)/hw-events.c libsim.a $(EXTRA_LIBS)
442
8e5f1516 443# See sim_pre_argv_init and sim_module_install in sim-module.c for more details.
015f7b74
MF
444modules.c: stamp-modules ; @true
445stamp-modules: Makefile $(SIM_OBJS:.o=.c)
65f42b88
MF
446 $(ECHO_STAMP) modules.c
447 $(SILENCE) LANG=C ; export LANG ; \
8e5f1516
MF
448 LC_ALL=C ; export LC_ALL ; \
449 sed -n -e '/^sim_install_/{s/^\(sim_install_[a-z_0-9A-Z]*\).*/\1/;p}' $^ | sort >$@.l-tmp
450 @set -e; (\
451 echo '/* Do not modify this file. */'; \
452 echo '/* It is created automatically by the Makefile. */'; \
453 echo '#include "libiberty.h"'; \
454 echo '#include "sim-module.h"'; \
cee4c731 455 sed -e 's:\(.*\):extern MODULE_INIT_FN \1;:' $@.l-tmp; \
8e5f1516
MF
456 echo 'MODULE_INSTALL_FN * const sim_modules_detected[] = {'; \
457 sed -e 's:\(.*\): \1,:' $@.l-tmp; \
458 echo '};'; \
459 echo 'const int sim_modules_detected_len = ARRAY_SIZE (sim_modules_detected);'; \
460 ) >$@.tmp
4f2b181e 461 $(SILENCE) $(SHELL) $(srcroot)/move-if-change $@.tmp modules.c
65f42b88 462 $(SILENCE) rm -f $@.l-tmp $@.tmp
b6143d31 463 $(SILENCE) touch $@
8e5f1516 464
c906108c
SS
465# CGEN support.
466
467# For use in Makefile.in for cpu-specific files.
468CGEN_MAIN_CPU_DEPS = \
469 $(SIM_MAIN_DEPS) \
c906108c 470 $(srccom)/cgen-ops.h \
80532737 471 $(srccom)/cgen-mem.h
c906108c 472
c906108c
SS
473# Support targets.
474
475install: install-common $(SIM_EXTRA_INSTALL)
476
477install-common: installdirs
a0e674c1 478 a=`basename "$$(pwd)"`; \
c906108c 479 n=`echo run | sed '$(program_transform_name)'`; \
a0e674c1 480 [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
149cfe5b 481 $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
fccf4ba5 482 n=`echo sim | sed '$(program_transform_name)'`; \
a0e674c1
MF
483 a=`basename "$$(pwd)"`; \
484 [ "$(SIM_PRIMARY_TARGET)" = "$$a" ] || n="$$n-$$a"; \
485 n="lib$$n.a"; \
149cfe5b
DJ
486 $(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \
487 ( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n )
c906108c
SS
488
489installdirs:
149cfe5b
DJ
490 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)
491 $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
c906108c
SS
492
493check:
c906108c 494
0d0878d7
MF
495html:
496clean-html:
497install-html:
498
c906108c
SS
499info:
500clean-info:
501install-info:
502
0d0878d7
MF
503pdf:
504clean-pdf:
505install-pdf:
506
c906108c
SS
507.NOEXPORT:
508MAKEOVERRIDES=
509
510tags etags: TAGS
511
512# Macros like EXTERN_SIM_CORE confuse tags.
513# And the sim-n-foo.h files create functions that can't be found either.
514TAGS: force
515 cd $(srcdir) && \
509deab2 516 etags --regex '/^\([[:lower:]_]+\) (/\1/' --regex '/^\/[*] TAGS: .*/' \
c906108c
SS
517 *.[ch] ../common/*.[ch]
518
be866656 519mostlyclean clean: $(SIM_EXTRA_CLEAN)
2213e33d
MF
520 rm -f *.[oa] *~ core \
521 run$(EXEEXT) libsim.a \
522 hw-config.h stamp-hw \
523 modules.c stamp-modules \
524 gentmap targ-map.c targ-vals.h stamp-tvals \
525 tmp-mloop.hin tmp-mloop.h tmp-mloop.cin tmp-mloop.c
c906108c 526
be866656 527distclean maintainer-clean realclean: clean $(SIM_EXTRA_DISTCLEAN)
c906108c
SS
528 rm -f TAGS
529 rm -f Makefile config.cache config.log config.status .gdbinit
c906108c
SS
530
531.c.o:
db2e4d67
MF
532 $(COMPILE) $<
533 $(POSTCOMPILE)
c906108c
SS
534
535# Dummy target to force execution of dependent targets.
536force:
537
36bb57e4 538Makefile: Makefile.in $(srccom)/Make-common.in $(config.status)
9709fa5b
MF
539@SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) CONFIG_HEADERS= $(SHELL) ./config.status
540@SIM_COMMON_BUILD_TRUE@ $(ECHO_GEN) pwd=`pwd` && subdir=`basename "$$pwd"` && cd .. && \
cc717561 541@SIM_COMMON_BUILD_TRUE@ $(SHELL) ./config.status Make-common.sim $$subdir/Makefile.sim $$subdir/Makefile
c906108c 542
36bb57e4 543@SIM_COMMON_BUILD_FALSE@config.status: configure
9709fa5b 544@SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) $(SHELL) ./config.status --recheck
c906108c 545
c906108c 546.gdbinit: # config.status $(srccom)/gdbinit.in
9709fa5b 547@SIM_COMMON_BUILD_FALSE@ $(ECHO_GEN) CONFIG_FILES=$@:../common/gdbinit.in CONFIG_HEADERS= $(SHELL) ./config.status
c906108c
SS
548
549
604259a0
FCE
550# CGEN support
551
2fe36d31
MF
552GUILE = `if [ -f ../../guile/libguile/guile ]; then echo ../../guile/libguile/guile; else echo guile ; fi`
553CGEN = "$(GUILE) -l $(CGENDIR)/guile.scm -s"
604259a0 554CGENFLAGS = -v
e3e473da 555CGEN_CPU_DIR = $(CGENDIR)/cpu
604259a0 556
6a8b8615
DE
557# Most ports use the files here instead of cgen/cpu.
558CPU_DIR = $(srcroot)/cpu
559
7ede505a 560CGEN_READ_SCM = $(CGENDIR)/sim.scm
e3e473da
BE
561CGEN_ARCH_SCM = $(CGENDIR)/sim-arch.scm
562CGEN_CPU_SCM = $(CGENDIR)/sim-cpu.scm $(CGENDIR)/sim-model.scm
563CGEN_DECODE_SCM = $(CGENDIR)/sim-decode.scm
564CGEN_DESC_SCM = $(CGENDIR)/desc.scm $(CGENDIR)/desc-cpu.scm
604259a0
FCE
565
566# Various choices for which cpu specific files to generate.
2c2a86d7
DE
567# These are passed to cgen.sh in the "extrafiles" argument.
568CGEN_CPU_EXTR = /extr/
569CGEN_CPU_READ = /read/
570CGEN_CPU_WRITE = /write/
571CGEN_CPU_SEM = /sem/
572CGEN_CPU_SEMSW = /semsw/
604259a0
FCE
573
574CGEN_FLAGS_TO_PASS = \
9ab46d53 575 CGEN='$(CGEN)' \
604259a0
FCE
576 CGENFLAGS="$(CGENFLAGS)"
577
578# We store the generated files in the source directory until we decide to
579# ship a Scheme interpreter with gdb/binutils. Maybe we never will.
580
581cgen-arch: force
582 $(SHELL) $(srccom)/cgen.sh arch $(srcdir) \
583 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81
DB
584 $(arch) "$(FLAGS)" ignored "$(isa)" $(mach) ignored \
585 $(archfile) ignored
3c25f8c7 586
604259a0
FCE
587cgen-cpu: force
588 $(SHELL) $(srccom)/cgen.sh cpu $(srcdir) \
589 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81
DB
590 $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \
591 $(archfile) "$(EXTRAFILES)"
604259a0 592
c79688eb
BE
593cgen-defs: force
594 $(SHELL) $(srccom)/cgen.sh defs $(srcdir) \
595 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81
DB
596 $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \
597 $(archfile) ignored
c79688eb 598
604259a0
FCE
599cgen-decode: force
600 $(SHELL) $(srccom)/cgen.sh decode $(srcdir) \
601 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81
DB
602 $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \
603 $(archfile) "$(EXTRAFILES)"
604259a0
FCE
604
605cgen-cpu-decode: force
606 $(SHELL) $(srccom)/cgen.sh cpu-decode $(srcdir) \
607 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81
DB
608 $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \
609 $(archfile) "$(EXTRAFILES)"
604259a0
FCE
610
611cgen-desc: force
612 $(SHELL) $(srccom)/cgen.sh desc $(srcdir) \
613 $(CGEN) $(CGENDIR) "$(CGENFLAGS)" \
ea52ff81 614 $(arch) "$(FLAGS)" $(cpu) "$(isa)" $(mach) "$(SUFFIX)" \
ad6e5d2e 615 $(archfile) ignored $(opcfile)
604259a0 616
c906108c 617## End COMMON_POST_CONFIG_FRAG