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