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