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