* sim-signal.c, sim-signal.h: New files.
[deliverable/binutils-gdb.git] / sim / common / Make-common.in
CommitLineData
f2de7dfd
AC
1# Makefile fragment for common parts of all simulators.
2# Copyright (C) 1997 Free Software Foundation, Inc.
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
7# the Free Software Foundation; either version 2 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, write to the Free Software
17# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19# This Makefile fragment consists of two separate parts.
20# They are merged into the final Makefile at points denoted by
21# "## COMMON_PRE_CONFIG_FRAG" and "## COMMON_POST_CONFIG_FRAG".
22#
23# The target Makefile should look like:
24#
25#># Copyright blah blah
26#>
27#>## COMMON_PRE_CONFIG_FRAG
28#>
29#># Any overrides necessary for the SIM_FOO config vars.
30#>SIM_FOO = ...
31#>
32#>## COMMON_POST_CONFIG_FRAG
33#>
34#># Rules to build target specific .o's.
35
36## COMMON_PRE_CONFIG_FRAG
37
38VPATH = @srcdir@
39srcdir = @srcdir@
38377b3a 40srccom = $(srcdir)/../common
f2de7dfd
AC
41srcroot = $(srcdir)/../..
42
43prefix = @prefix@
44exec_prefix = @exec_prefix@
45
46host_alias = @host_alias@
47target_alias = @target_alias@
48program_transform_name = @program_transform_name@
49bindir = @bindir@
50
51libdir = @libdir@
52tooldir = $(libdir)/$(target_alias)
53
54datadir = @datadir@
55mandir = @mandir@
56man1dir = $(mandir)/man1
57infodir = @infodir@
58includedir = @includedir@
59
60SHELL = /bin/sh
61
6808fd61 62INSTALL = @INSTALL@
f2de7dfd
AC
63INSTALL_PROGRAM = @INSTALL_PROGRAM@
64INSTALL_DATA = @INSTALL_DATA@
f2de7dfd
AC
65
66CC = @CC@
67CC_FOR_BUILD = @CC_FOR_BUILD@
68CFLAGS = @CFLAGS@
69SIM_BSWAP = @sim_bswap@
70SIM_CFLAGS = @sim_cflags@
71SIM_DEBUG = @sim_debug@
f2de7dfd 72SIM_TRACE = @sim_trace@
717dbb29 73SIM_PROFILE = @sim_profile@
a77aa7ec 74
92f91d1f
AC
75SIM_ASSERT = @sim_assert@
76SIM_ALIGNMENT = @sim_alignment@
7456a10d 77SIM_BITSIZE = @sim_bitsize@
4141b1c6 78SIM_DEFAULT_MODEL = @sim_default_model@
92f91d1f
AC
79SIM_ENDIAN = @sim_endian@
80SIM_FLOAT = @sim_float@
81SIM_HARDWARE = @sim_hardware@
82SIM_HOSTENDIAN = @sim_hostendian@
83SIM_INLINE = @sim_inline@
84SIM_PACKAGES = @sim_packages@
85SIM_REGPARM = @sim_regparm@
86SIM_RESERVED_BITS = @sim_reserved_bits@
4141b1c6 87SIM_SCACHE = @sim_scache@
92f91d1f
AC
88SIM_SMP = @sim_smp@
89SIM_STDCALL = @sim_stdcall@
90SIM_WARNINGS = @sim_warnings@
91SIM_XOR_ENDIAN = @sim_xor_endian@
92
f2de7dfd
AC
93HDEFINES = @HDEFINES@
94TDEFINES =
95
96AR = @AR@
97AR_FLAGS = rc
98RANLIB = @RANLIB@
99MAKEINFO = makeinfo
100
f7abc1ca
DE
101DEP = $(srcroot)/mkdep
102
f2de7dfd 103# Each simulator's Makefile.in defines one or more of these variables
0f2811d1
DE
104# to override our settings as necessary. There is no need to define these
105# in the simulator's Makefile.in if one is using the default value. In fact
106# it's preferable not to.
f2de7dfd
AC
107
108# List of object files, less common parts.
109SIM_OBJS =
6808fd61
ILT
110# List of extra dependencies.
111# Generally this consists of simulator specific files included by sim-main.h.
112SIM_EXTRA_DEPS =
f2de7dfd
AC
113# List of flags to always pass to $(CC).
114SIM_EXTRA_CFLAGS =
115# List of extra libraries to link with.
116SIM_EXTRA_LIBS =
117# List of extra program dependencies.
118SIM_EXTRA_LIBDEPS =
119# List of main object files for `run'.
120SIM_RUN_OBJS = run.o
121# Dependency of `all' to build any extra files.
122SIM_EXTRA_ALL =
123# Dependency of `install' to install any extra files.
124SIM_EXTRA_INSTALL =
125# Dependency of `clean' to clean any extra files.
126SIM_EXTRA_CLEAN =
127
e5ce1670
DE
128# Every time a new general purpose source file was added every target's
129# Makefile.in needed to be updated to include the file in SIM_OBJS.
130# This doesn't scale.
131# This variable specifies all the generic stuff common to the newer simulators.
132# Things like sim-reason.o can't go here as the cpu may provide its own
133# (though hopefully in time that won't be so). Things like sim-bits.o can go
134# here. Some files are used by all simulators (e.g. callback.o).
135# Those files are specified in LIB_OBJS below.
136
137SIM_NEW_COMMON_OBJS = \
138 sim-bits.o \
139 sim-break.o \
140 sim-config.o \
141 sim-core.o \
142 sim-endian.o \
143 sim-events.o \
144 sim-fpu.o \
145 sim-io.o \
146 sim-load.o \
147 sim-memopt.o \
148 sim-module.o \
149 sim-options.o \
150 sim-profile.o \
1ebc7e0e 151 sim-signal.o \
e5ce1670
DE
152 sim-trace.o \
153 sim-utils.o \
154 sim-watch.o
155
f2de7dfd
AC
156## End COMMON_PRE_CONFIG_FRAG
157
158## COMMON_POST_CONFIG_FRAG
159
92f91d1f
AC
160CONFIG_CFLAGS = @DEFS@ \
161 $(SIM_CFLAGS) \
162 $(SIM_DEBUG) \
4141b1c6 163 $(SIM_DEFAULT_MODEL) \
92f91d1f
AC
164 $(SIM_TRACE) \
165 $(SIM_PROFILE) \
166 $(SIM_BSWAP) \
167 $(SIM_ASSERT) \
168 $(SIM_ALIGNMENT) \
7456a10d 169 $(SIM_BITSIZE) \
92f91d1f
AC
170 $(SIM_ENDIAN) \
171 $(SIM_FLOAT) \
172 $(SIM_HARDWARE) \
173 $(SIM_HOSTENDIAN) \
174 $(SIM_INLINE) \
175 $(SIM_PACKAGES) \
176 $(SIM_REGPARM) \
177 $(SIM_RESERVED_BITS) \
4141b1c6 178 $(SIM_SCACHE) \
92f91d1f
AC
179 $(SIM_SMP) \
180 $(SIM_STDCALL) \
181 $(SIM_WARNINGS) \
182 $(SIM_XOR_ENDIAN) \
183 $(SIM_EXTRA_CFLAGS) \
184 $(HDEFINES) $(TDEFINES)
38377b3a 185CSEARCH = -I. -I$(srcdir) -I../common -I$(srccom) \
f2de7dfd 186 -I../../include -I$(srcroot)/include \
a77aa7ec 187 -I../../bfd -I$(srcroot)/bfd \
f2de7dfd
AC
188 -I../../opcodes -I$(srcroot)/opcodes
189ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS)
190BUILD_CFLAGS = -g -O $(CSEARCH)
191
f7abc1ca
DE
192COMMON_DEP_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH)
193
f2de7dfd
AC
194LIBIBERTY_LIB = ../../libiberty/libiberty.a
195BFD_LIB = ../../bfd/libbfd.a
196OPCODES_LIB = ../../opcodes/libopcodes.a
197CONFIG_LIBS = @LIBS@
198LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
199 $(SIM_EXTRA_LIBDEPS)
200EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
201 $(CONFIG_LIBS) $(SIM_EXTRA_LIBS)
202
f7abc1ca 203LIB_OBJS = callback.o syscall.o targ-map.o $(SIM_OBJS)
f2de7dfd 204
7456a10d 205all: $(SIM_EXTRA_ALL) libsim.a run
f2de7dfd
AC
206
207libsim.a: $(LIB_OBJS)
208 rm -f libsim.a
fafce69a 209 $(AR) $(AR_FLAGS) libsim.a $(LIB_OBJS)
f2de7dfd
AC
210 $(RANLIB) libsim.a
211
212run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
213 $(CC) $(ALL_CFLAGS) -o run \
214 $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
215
38377b3a 216run.o: $(srccom)/run.c config.h tconfig.h \
f2de7dfd 217 $(srcroot)/include/callback.h
38377b3a 218 $(CC) -c $(srccom)/run.c $(ALL_CFLAGS)
f2de7dfd
AC
219
220# FIXME: Ideally, callback.o and friends live in a library outside of
221# both the gdb and simulator source trees (e.g. devo/remote. Not
222# devo/libremote because this directory would contain more than just
223# a library).
224
38377b3a 225callback.o: $(srccom)/callback.c config.h tconfig.h \
f2de7dfd 226 $(srcroot)/include/callback.h targ-vals.h
38377b3a 227 $(CC) -c $(srccom)/callback.c $(ALL_CFLAGS)
f2de7dfd 228
38377b3a 229syscall.o: $(srccom)/syscall.c config.h tconfig.h \
f7abc1ca 230 $(srcroot)/include/callback.h targ-vals.h
38377b3a 231 $(CC) -c $(srccom)/syscall.c $(ALL_CFLAGS)
f7abc1ca 232
f2de7dfd
AC
233targ-map.o: targ-map.c targ-vals.h
234
38377b3a
DE
235gentmap: Makefile $(srccom)/gentmap.c targ-vals.def
236 $(CC_FOR_BUILD) $(srccom)/gentmap.c -o gentmap $(BUILD_CFLAGS) $(NL_TARGET)
f2de7dfd
AC
237
238targ-vals.h: gentmap
239 rm -f targ-vals.h
240 ./gentmap -h >targ-vals.h
241
242targ-map.c: gentmap
243 rm -f targ-map.c
244 ./gentmap -c >targ-map.c
245
a35e91c3
AC
246
247#
248# Rules for building sim-* components. Triggered by listing the corresponding
249# .o file in the list of simulator targets.
250#
251
6808fd61
ILT
252sim_main_headers = \
253 sim-main.h \
38377b3a
DE
254 $(srccom)/sim-config.h \
255 $(srccom)/sim-base.h \
256 $(srccom)/sim-basics.h \
257 $(srccom)/sim-memopt.h \
258 $(srccom)/sim-model.h \
259 $(srccom)/sim-module.h \
260 $(srccom)/sim-trace.h \
261 $(srccom)/sim-profile.h \
262 $(srccom)/sim-engine.h \
263 $(srccom)/sim-events.h \
264 $(srccom)/sim-watch.h \
265 $(srccom)/sim-assert.h \
f7abc1ca
DE
266 tconfig.h \
267 $(SIM_EXTRA_DEPS)
6808fd61 268
38377b3a
DE
269sim-assert_h = $(srccom)/sim-assert.h
270sim-endian_h = $(srccom)/sim-endian.h
271sim-n-endian_h = $(srccom)/sim-n-endian.h
272sim-bits_h = $(srccom)/sim-bits.h
273sim-config_h = $(srccom)/sim-config.h
274sim-n-bits_h = $(srccom)/sim-n-bits.h
275sim-core_h = $(srccom)/sim-core.h
276sim-n-core_h = $(srccom)/sim-n-core.h
277sim-engine_h = $(srccom)/sim-engine.h
278sim-events_h = $(srccom)/sim-events.h
279sim-fpu_h = $(srccom)/sim-fpu.h
280sim-io_h = $(srccom)/sim-io.h
281sim-options_h = $(srccom)/sim-options.h
282sim-break_h = $(srccom)/sim-break.h
1ebc7e0e 283sim-signal_h = $(srccom)/sim-signal.h
a35e91c3 284
6808fd61 285# FIXME: If this complicated way of building .o files from ../common is
c967f187 286# necessary, the reason should be documented here.
6808fd61
ILT
287
288BUILT_SRC_FROM_COMMON= \
5dcf955d 289 sim-inline.c
6808fd61 290
38377b3a 291sim-abort.o: $(srccom)/sim-abort.c \
f7abc1ca 292 $(SIM_EXTRA_DEPS)
38377b3a 293 $(CC) -c $(srccom)/sim-abort.c $(ALL_CFLAGS)
f03b093c 294
38377b3a 295sim-bits.o: $(srccom)/sim-bits.c $(sim-bits_h) $(sim-n-bits_h) \
f7abc1ca 296 $(SIM_EXTRA_DEPS)
38377b3a 297 $(CC) -c $(srccom)/sim-bits.c $(ALL_CFLAGS)
a35e91c3 298
38377b3a 299sim-config.o: $(srccom)/sim-config.c $(sim-config_h) \
6808fd61 300 $(SIM_EXTRA_DEPS)
38377b3a 301 $(CC) -c $(srccom)/sim-config.c $(ALL_CFLAGS)
a35e91c3 302
38377b3a 303sim-core.o: $(srccom)/sim-core.c $(sim-core_h) $(sim-n-core_h) \
f7abc1ca 304 $(SIM_EXTRA_DEPS)
38377b3a 305 $(CC) -c $(srccom)/sim-core.c $(ALL_CFLAGS)
a35e91c3 306
38377b3a 307sim-endian.o: $(srccom)/sim-endian.c $(sim-endian_h) $(sim-n-endian_h) \
f7abc1ca 308 $(SIM_EXTRA_DEPS)
38377b3a 309 $(CC) -c $(srccom)/sim-endian.c $(ALL_CFLAGS)
a35e91c3 310
38377b3a
DE
311sim-engine.o: $(srccom)/sim-engine.c $(sim_main_headers) $(sim-engine_h)
312 $(CC) -c $(srccom)/sim-engine.c $(ALL_CFLAGS)
f03b093c 313
38377b3a 314sim-events.o: $(srccom)/sim-events.c $(sim-events_h) \
f7abc1ca 315 $(SIM_EXTRA_DEPS)
38377b3a 316 $(CC) -c $(srccom)/sim-events.c $(ALL_CFLAGS)
a35e91c3 317
38377b3a 318sim-fpu.o: $(srccom)/sim-fpu.c $(sim-fpu_h) \
f7abc1ca 319 $(SIM_EXTRA_DEPS)
38377b3a 320 $(CC) -c $(srccom)/sim-fpu.c $(ALL_CFLAGS)
fafce69a 321
38377b3a 322sim-hload.o: $(srccom)/sim-hload.c $(sim-assert_h) \
f7abc1ca 323 $(SIM_EXTRA_DEPS)
38377b3a 324 $(CC) -c $(srccom)/sim-hload.c $(ALL_CFLAGS)
3971886a 325
38377b3a 326sim-hrw.o: $(srccom)/sim-hrw.c $(sim-assert_h) \
f7abc1ca 327 $(SIM_EXTRA_DEPS)
38377b3a 328 $(CC) -c $(srccom)/sim-hrw.c $(ALL_CFLAGS)
92f91d1f 329
38377b3a 330sim-inline.c: $(srccom)/sim-inline.c
a35e91c3 331 rm -f $@ tmp-$@
38377b3a
DE
332 echo "# 1 \"$(srccom)/$@\"" > tmp-$@
333 cat $(srccom)/$@ >> tmp-$@
a35e91c3
AC
334 $(srcdir)/../../move-if-change tmp-$@ $@
335
38377b3a
DE
336sim-io.o: $(srccom)/sim-io.c $(sim_main_headers) $(sim-io_h)
337 $(CC) -c $(srccom)/sim-io.c $(ALL_CFLAGS)
a35e91c3 338
38377b3a 339sim-memopt.o: $(srccom)/sim-memopt.c $(sim_main_headers) \
f7abc1ca 340 $(sim-io_h)
38377b3a 341 $(CC) -c $(srccom)/sim-memopt.c $(ALL_CFLAGS)
a34abff8 342
38377b3a 343sim-module.o: $(srccom)/sim-module.c $(sim_main_headers) \
f7abc1ca 344 $(sim-io_h)
38377b3a 345 $(CC) -c $(srccom)/sim-module.c $(ALL_CFLAGS)
717dbb29 346
38377b3a 347sim-options.o: $(srccom)/sim-options.c $(sim_main_headers) \
f7abc1ca 348 $(sim-options_h) $(sim-io_h)
38377b3a 349 $(CC) -c $(srccom)/sim-options.c $(ALL_CFLAGS)
0f2811d1 350
38377b3a
DE
351sim-reason.o: $(srccom)/sim-reason.c $(sim_main_headers)
352 $(CC) -c $(srccom)/sim-reason.c $(ALL_CFLAGS)
f03b093c 353
38377b3a
DE
354sim-resume.o: $(srccom)/sim-resume.c $(sim_main_headers)
355 $(CC) -c $(srccom)/sim-resume.c $(ALL_CFLAGS)
f03b093c 356
38377b3a
DE
357sim-run.o: $(srccom)/sim-run.c $(sim_main_headers)
358 $(CC) -c $(srccom)/sim-run.c $(ALL_CFLAGS)
f03b093c 359
1ebc7e0e
DE
360sim-signal.o: $(srccom)/sim-signal.c $(sim_main_headers) $(sim-signal_h)
361 $(CC) -c $(srccom)/sim-signal.c $(ALL_CFLAGS)
362
38377b3a
DE
363sim-stop.o: $(srccom)/sim-stop.c $(sim_main_headers)
364 $(CC) -c $(srccom)/sim-stop.c $(ALL_CFLAGS)
f03b093c 365
38377b3a 366sim-trace.o: $(srccom)/sim-trace.c $(sim_main_headers) \
f7abc1ca 367 $(sim-options_h) $(sim-io_h)
38377b3a 368 $(CC) -c $(srccom)/sim-trace.c $(ALL_CFLAGS)
e9b2f579 369
38377b3a 370sim-profile.o: $(srccom)/sim-profile.c $(sim_main_headers) \
f7abc1ca 371 $(sim-options_h) $(sim-io_h)
38377b3a 372 $(CC) -c $(srccom)/sim-profile.c $(ALL_CFLAGS)
717dbb29 373
38377b3a 374sim-model.o: $(srccom)/sim-model.c $(sim_main_headers) \
f7abc1ca 375 $(sim-io_h)
38377b3a 376 $(CC) -c $(srccom)/sim-model.c $(ALL_CFLAGS)
c967f187 377
38377b3a
DE
378sim-utils.o: $(srccom)/sim-utils.c $(sim_main_headers)
379 $(CC) -c $(srccom)/sim-utils.c $(ALL_CFLAGS)
a35e91c3 380
38377b3a
DE
381sim-watch.o: $(srccom)/sim-watch.c $(sim_main_headers)
382 $(CC) -c $(srccom)/sim-watch.c $(ALL_CFLAGS)
fafce69a 383
38377b3a
DE
384sim-load.o: $(srccom)/sim-load.c $(srcroot)/include/callback.h
385 $(CC) -c $(srccom)/sim-load.c $(ALL_CFLAGS)
0f2811d1 386
38377b3a 387sim-break.o: $(srccom)/sim-break.c $(sim_main_headers) \
f7abc1ca 388 $(sim_break_h)
38377b3a 389 $(CC) -c $(srccom)/sim-break.c $(ALL_CFLAGS)
b9d580a4 390
38377b3a 391nrun.o: $(srccom)/nrun.c config.h tconfig.h \
c95d08a8 392 $(srcroot)/include/callback.h $(sim_main_headers)
38377b3a 393 $(CC) -c $(srccom)/nrun.c $(ALL_CFLAGS)
a35e91c3 394
c967f187
DE
395# CGEN support.
396
38377b3a
DE
397cgen-run.o: $(srccom)/cgen-run.c $(sim_main_headers) \
398 $(srccom)/cgen-mem.h $(srccom)/cgen-ops.h \
399 $(srccom)/cgen-scache.h
400 $(CC) -c $(srccom)/cgen-run.c $(ALL_CFLAGS)
88d5f8e8 401
38377b3a
DE
402cgen-scache.o: $(srccom)/cgen-scache.c $(sim_main_headers) \
403 $(srccom)/cgen-scache.h
404 $(CC) -c $(srccom)/cgen-scache.c $(ALL_CFLAGS)
c967f187 405
38377b3a
DE
406cgen-trace.o: $(srccom)/cgen-trace.c $(sim_main_headers) \
407 $(srccom)/cgen-trace.h
408 $(CC) -c $(srccom)/cgen-trace.c $(ALL_CFLAGS)
c967f187 409
38377b3a
DE
410cgen-utils.o: $(srccom)/cgen-utils.c $(sim_main_headers) \
411 $(srccom)/cgen-mem.h $(srccom)/cgen-ops.h
412 $(CC) -c $(srccom)/cgen-utils.c $(ALL_CFLAGS)
c967f187
DE
413
414# Support targets.
415
f2de7dfd
AC
416install: install-common $(SIM_EXTRA_INSTALL)
417
6808fd61
ILT
418install-common: installdirs
419 n=`echo run | sed '$(program_transform_name)'`; \
420 $(INSTALL_PROGRAM) run $(bindir)/$$n
421
422installdirs:
423 $(SHELL) $(srcdir)/../../mkinstalldirs $(bindir)
f2de7dfd
AC
424
425check:
426
427info:
428clean-info:
429install-info:
430
431.NOEXPORT:
432MAKEOVERRIDES=
433
434tags etags: TAGS
435
436TAGS: force
645ab3ec 437 etags --regex '/^\/[*] TAGS: .*/' *.c *.h
f2de7dfd 438
717dbb29 439clean: $(SIM_EXTRA_CLEAN)
f2de7dfd
AC
440 rm -f *.[oa] *~ core
441 rm -f run libsim.a
442 rm -f gentmap targ-map.c targ-vals.h
f7abc1ca 443 if [ ! -f Make-common.in ] ; then \
5dcf955d
DE
444 rm -f $(BUILT_SRC_FROM_COMMON) ; \
445 fi
f2de7dfd 446
717dbb29 447distclean mostlyclean maintainer-clean realclean: clean
f2de7dfd 448 rm -f TAGS
88d5f8e8 449 rm -f Makefile config.cache config.log config.status .gdbinit
f2de7dfd 450 rm -f tconfig.h config.h stamp-h
0f399b0c 451 rm -f targ-vals.def
f2de7dfd
AC
452
453.c.o:
454 $(CC) -c $(ALL_CFLAGS) $<
455
456# Dummy target to force execution of dependent targets.
457force:
458
38377b3a 459Makefile: Makefile.in $(srccom)/Make-common.in config.status
f2de7dfd
AC
460 CONFIG_HEADERS= $(SHELL) ./config.status
461
462config.status: configure
463 $(SHELL) ./config.status --recheck
464
465config.h: stamp-h ; @true
466stamp-h: config.in config.status
467 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
468
38377b3a 469.gdbinit: # config.status $(srccom)/gdbinit.in
88d5f8e8
DE
470 CONFIG_FILES=$@:../common/gdbinit.in CONFIG_HEADERS= $(SHELL) ./config.status
471
f2de7dfd 472## End COMMON_POST_CONFIG_FRAG
This page took 0.063912 seconds and 4 git commands to generate.