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