(EXTRACT_SIGNED,EXTRACT_UNSIGNED,HOST_LONGS_FOR_BITS): Move from
[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
f2de7dfd
AC
74
75HDEFINES = @HDEFINES@
76TDEFINES =
77
78AR = @AR@
79AR_FLAGS = rc
80RANLIB = @RANLIB@
81MAKEINFO = makeinfo
82
83# Each simulator's Makefile.in defines one or more of these variables
0f2811d1
DE
84# to override our settings as necessary. There is no need to define these
85# in the simulator's Makefile.in if one is using the default value. In fact
86# it's preferable not to.
f2de7dfd
AC
87
88# List of object files, less common parts.
89SIM_OBJS =
6808fd61
ILT
90# List of extra dependencies.
91# Generally this consists of simulator specific files included by sim-main.h.
92SIM_EXTRA_DEPS =
f2de7dfd
AC
93# List of flags to always pass to $(CC).
94SIM_EXTRA_CFLAGS =
95# List of extra libraries to link with.
96SIM_EXTRA_LIBS =
97# List of extra program dependencies.
98SIM_EXTRA_LIBDEPS =
99# List of main object files for `run'.
100SIM_RUN_OBJS = run.o
101# Dependency of `all' to build any extra files.
102SIM_EXTRA_ALL =
103# Dependency of `install' to install any extra files.
104SIM_EXTRA_INSTALL =
105# Dependency of `clean' to clean any extra files.
106SIM_EXTRA_CLEAN =
107
108## End COMMON_PRE_CONFIG_FRAG
109
110## COMMON_POST_CONFIG_FRAG
111
717dbb29
DE
112CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(SIM_DEBUG) $(SIM_TRACE) $(SIM_PROFILE) \
113 $(SIM_BSWAP) $(SIM_EXTRA_CFLAGS) $(HDEFINES) $(TDEFINES)
f2de7dfd
AC
114CSEARCH = -I. -I$(srcdir) -I../common -I$(srcdir)/../common \
115 -I../../include -I$(srcroot)/include \
a77aa7ec 116 -I../../bfd -I$(srcroot)/bfd \
f2de7dfd
AC
117 -I../../opcodes -I$(srcroot)/opcodes
118ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS)
119BUILD_CFLAGS = -g -O $(CSEARCH)
120
121LIBIBERTY_LIB = ../../libiberty/libiberty.a
122BFD_LIB = ../../bfd/libbfd.a
123OPCODES_LIB = ../../opcodes/libopcodes.a
124CONFIG_LIBS = @LIBS@
125LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
126 $(SIM_EXTRA_LIBDEPS)
127EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
128 $(CONFIG_LIBS) $(SIM_EXTRA_LIBS)
129
130LIB_OBJS = callback.o targ-map.o $(SIM_OBJS)
131
132all: libsim.a run $(SIM_EXTRA_ALL)
133
134libsim.a: $(LIB_OBJS)
135 rm -f libsim.a
136 $(AR) $(ARFLAGS) libsim.a $(LIB_OBJS)
137 $(RANLIB) libsim.a
138
139run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
140 $(CC) $(ALL_CFLAGS) -o run \
141 $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
142
143run.o: $(srcdir)/../common/run.c config.h tconfig.h \
144 $(srcroot)/include/callback.h
145 $(CC) -c $(srcdir)/../common/run.c $(ALL_CFLAGS)
146
147# FIXME: Ideally, callback.o and friends live in a library outside of
148# both the gdb and simulator source trees (e.g. devo/remote. Not
149# devo/libremote because this directory would contain more than just
150# a library).
151
152callback.o: $(srcdir)/../common/callback.c config.h tconfig.h \
153 $(srcroot)/include/callback.h targ-vals.h
154 $(CC) -c $(srcdir)/../common/callback.c $(ALL_CFLAGS)
155
156targ-map.o: targ-map.c targ-vals.h
157
158gentmap: Makefile $(srcdir)/../common/gentmap.c targ-vals.def
159 $(CC_FOR_BUILD) $(srcdir)/../common/gentmap.c -o gentmap $(BUILD_CFLAGS)
160
161targ-vals.h: gentmap
162 rm -f targ-vals.h
163 ./gentmap -h >targ-vals.h
164
165targ-map.c: gentmap
166 rm -f targ-map.c
167 ./gentmap -c >targ-map.c
168
a35e91c3
AC
169
170#
171# Rules for building sim-* components. Triggered by listing the corresponding
172# .o file in the list of simulator targets.
173#
174
6808fd61
ILT
175sim_main_headers = \
176 sim-main.h \
177 $(srcdir)/../common/sim-config.h \
178 $(srcdir)/../common/sim-base.h \
179 $(srcdir)/../common/sim-basics.h \
717dbb29
DE
180 $(srcdir)/../common/sim-module.h \
181 $(srcdir)/../common/sim-model.h \
0f2811d1 182 $(srcdir)/../common/sim-trace.h \
717dbb29 183 $(srcdir)/../common/sim-profile.h \
6808fd61
ILT
184 tconfig.h
185
a35e91c3
AC
186sim-assert_h = $(srcdir)/../common/sim-assert.h
187sim-endian_h = $(srcdir)/../common/sim-endian.h
188sim-n-endian_h = $(srcdir)/../common/sim-n-endian.h
189sim-bits_h = $(srcdir)/../common/sim-bits.h
190sim-config_h = $(srcdir)/../common/sim-config.h
191sim-n-bits_h = $(srcdir)/../common/sim-n-bits.h
192sim-core_h = $(srcdir)/../common/sim-core.h
193sim-n-core_h = $(srcdir)/../common/sim-n-core.h
194sim-events_h = $(srcdir)/../common/sim-events.h
195sim-io_h = $(srcdir)/../common/sim-io.h
196sim-n-io_h = $(srcdir)/../common/sim-n-io.h
197
6808fd61
ILT
198# FIXME: If this complicated way of building .o files from ../common is
199# necessary, the reason should be documented here!
200
201BUILT_SRC_FROM_COMMON= \
202 sim-endian.c \
203 sim-inline.c \
204 sim-bits.c \
205 sim-events.c \
206 sim-core.c \
207 sim-config.c \
208 sim-io.c
209
210sim-bits.o: sim-bits.c $(sim-bits_h) $(sim-n-bits_h) $(sim-assert_h) \
211 $(SIM_EXTRA_DEPS)
a35e91c3
AC
212sim-bits.c: $(srcdir)/../common/sim-bits.c
213 rm -f $@ tmp-$@
214 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
215 cat $(srcdir)/../common/$@ >> tmp-$@
216 $(srcdir)/../../move-if-change tmp-$@ $@
217
6808fd61
ILT
218sim-config.o: sim-config.c $(sim-config_h) $(sim-nconfig_h) $(sim-assert_h) \
219 $(SIM_EXTRA_DEPS)
a35e91c3
AC
220sim-config.c: $(srcdir)/../common/sim-config.c
221 rm -f $@ tmp-$@
222 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
223 cat $(srcdir)/../common/$@ >> tmp-$@
224 $(srcdir)/../../move-if-change tmp-$@ $@
225
6808fd61
ILT
226sim-core.o: sim-core.c $(sim-core_h) $(sim-n-core_h) \
227 $(SIM_EXTRA_DEPS)
a35e91c3
AC
228sim-core.c: $(srcdir)/../common/sim-core.c
229 rm -f $@ tmp-$@
230 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
231 cat $(srcdir)/../common/$@ >> tmp-$@
232 $(srcdir)/../../move-if-change tmp-$@ $@
233
6808fd61
ILT
234sim-endian.o: sim-endian.c $(sim-endian_h) $(sim-n-endian_h) $(sim-assert_h) \
235 $(SIM_EXTRA_DEPS)
a35e91c3
AC
236sim-endian.c: $(srcdir)/../common/sim-endian.c
237 rm -f $@ tmp-$@
238 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
239 cat $(srcdir)/../common/$@ >> tmp-$@
240 $(srcdir)/../../move-if-change tmp-$@ $@
241
6808fd61
ILT
242sim-events.o: sim-events.c $(sim-events_h) $(sim-assert_h) \
243 $(SIM_EXTRA_DEPS)
a35e91c3
AC
244sim-events.c: $(srcdir)/../common/sim-events.c
245 rm -f $@ tmp-$@
246 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
247 cat $(srcdir)/../common/$@ >> tmp-$@
248 $(srcdir)/../../move-if-change tmp-$@ $@
249
250sim-inline.c: $(srcdir)/../common/sim-inline.c
251 rm -f $@ tmp-$@
252 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
253 cat $(srcdir)/../common/$@ >> tmp-$@
254 $(srcdir)/../../move-if-change tmp-$@ $@
255
6808fd61
ILT
256sim-io.o: sim-io.c $(sim_main_headers) $(sim-io_h) $(sim-assert_h) \
257 $(SIM_EXTRA_DEPS)
a35e91c3
AC
258sim-io.c: $(srcdir)/../common/sim-io.c
259 rm -f $@ tmp-$@
260 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
261 cat $(srcdir)/../common/$@ >> tmp-$@
262 $(srcdir)/../../move-if-change tmp-$@ $@
263
717dbb29
DE
264sim-module.o: $(srcdir)/../common/sim-module.c $(sim_main_headers) \
265 $(srcdir)/../common/sim-io.h
266 $(CC) -c $(srcdir)/../common/sim-module.c $(ALL_CFLAGS)
267
e9b2f579 268sim-options.o: $(srcdir)/../common/sim-options.c $(sim_main_headers) \
0f2811d1
DE
269 $(srcdir)/../common/sim-options.h
270 $(CC) -c $(srcdir)/../common/sim-options.c $(ALL_CFLAGS)
271
e9b2f579
DE
272sim-trace.o: $(srcdir)/../common/sim-trace.c $(sim_main_headers) \
273 $(srcdir)/../common/sim-io.h
274 $(CC) -c $(srcdir)/../common/sim-trace.c $(ALL_CFLAGS)
275
717dbb29
DE
276sim-profile.o: $(srcdir)/../common/sim-profile.c $(sim_main_headers) \
277 $(srcdir)/../common/sim-io.h
278 $(CC) -c $(srcdir)/../common/sim-profile.c $(ALL_CFLAGS)
279
6808fd61
ILT
280sim-utils.o: $(srcdir)/../common/sim-utils.c $(sim_main_headers) \
281 $(SIM_EXTRA_DEPS)
282 $(CC) -c $(srcdir)/../common/sim-utils.c $(ALL_CFLAGS)
a35e91c3 283
0f2811d1
DE
284sim-load.o: $(srcdir)/../common/sim-load.c
285 $(CC) -c $(srcdir)/../common/sim-load.c $(ALL_CFLAGS)
286
c95d08a8
DE
287nrun.o: $(srcdir)/../common/nrun.c config.h tconfig.h \
288 $(srcroot)/include/callback.h $(sim_main_headers)
289 $(CC) -c $(srcdir)/../common/nrun.c $(ALL_CFLAGS)
a35e91c3 290
f2de7dfd
AC
291install: install-common $(SIM_EXTRA_INSTALL)
292
6808fd61
ILT
293install-common: installdirs
294 n=`echo run | sed '$(program_transform_name)'`; \
295 $(INSTALL_PROGRAM) run $(bindir)/$$n
296
297installdirs:
298 $(SHELL) $(srcdir)/../../mkinstalldirs $(bindir)
f2de7dfd
AC
299
300check:
301
302info:
303clean-info:
304install-info:
305
306.NOEXPORT:
307MAKEOVERRIDES=
308
309tags etags: TAGS
310
311TAGS: force
312 etags *.c *.h
313
717dbb29 314clean: $(SIM_EXTRA_CLEAN)
f2de7dfd
AC
315 rm -f *.[oa] *~ core
316 rm -f run libsim.a
317 rm -f gentmap targ-map.c targ-vals.h
6808fd61 318 rm -f $(BUILT_SRC_FROM_COMMON)
f2de7dfd 319
717dbb29 320distclean mostlyclean maintainer-clean realclean: clean
f2de7dfd
AC
321 rm -f TAGS
322 rm -f Makefile config.cache config.log config.status
323 rm -f tconfig.h config.h stamp-h
0f399b0c 324 rm -f targ-vals.def
f2de7dfd
AC
325
326.c.o:
327 $(CC) -c $(ALL_CFLAGS) $<
328
329# Dummy target to force execution of dependent targets.
330force:
331
332Makefile: Makefile.in $(srcdir)/../common/Make-common.in config.status
333 CONFIG_HEADERS= $(SHELL) ./config.status
334
335config.status: configure
336 $(SHELL) ./config.status --recheck
337
338config.h: stamp-h ; @true
339stamp-h: config.in config.status
340 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
341
342## End COMMON_POST_CONFIG_FRAG
This page took 0.041065 seconds and 4 git commands to generate.