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