* idecode_expression.h (ALU_END): From Charles Lefurgy - Extract
[deliverable/binutils-gdb.git] / sim / common / Make-common.in
... / ...
CommitLineData
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 = @INSTALL@
62INSTALL_PROGRAM = @INSTALL_PROGRAM@
63INSTALL_DATA = @INSTALL_DATA@
64
65CC = @CC@
66CC_FOR_BUILD = @CC_FOR_BUILD@
67CFLAGS = @CFLAGS@
68SIM_BSWAP = @sim_bswap@
69SIM_CFLAGS = @sim_cflags@
70SIM_DEBUG = @sim_debug@
71SIM_TRACE = @sim_trace@
72SIM_PROFILE = @sim_profile@
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. There is no need to define these
84# in the simulator's Makefile.in if one is using the default value. In fact
85# it's preferable not to.
86
87# List of object files, less common parts.
88SIM_OBJS =
89# List of extra dependencies.
90# Generally this consists of simulator specific files included by sim-main.h.
91SIM_EXTRA_DEPS =
92# List of flags to always pass to $(CC).
93SIM_EXTRA_CFLAGS =
94# List of extra libraries to link with.
95SIM_EXTRA_LIBS =
96# List of extra program dependencies.
97SIM_EXTRA_LIBDEPS =
98# List of main object files for `run'.
99SIM_RUN_OBJS = run.o
100# Dependency of `all' to build any extra files.
101SIM_EXTRA_ALL =
102# Dependency of `install' to install any extra files.
103SIM_EXTRA_INSTALL =
104# Dependency of `clean' to clean any extra files.
105SIM_EXTRA_CLEAN =
106
107## End COMMON_PRE_CONFIG_FRAG
108
109## COMMON_POST_CONFIG_FRAG
110
111CONFIG_CFLAGS = @DEFS@ $(SIM_CFLAGS) $(SIM_DEBUG) $(SIM_TRACE) $(SIM_PROFILE) \
112 $(SIM_BSWAP) $(SIM_EXTRA_CFLAGS) $(HDEFINES) $(TDEFINES)
113CSEARCH = -I. -I$(srcdir) -I../common -I$(srcdir)/../common \
114 -I../../include -I$(srcroot)/include \
115 -I../../bfd -I$(srcroot)/bfd \
116 -I../../opcodes -I$(srcroot)/opcodes
117ALL_CFLAGS = $(CONFIG_CFLAGS) $(CSEARCH) $(CFLAGS)
118BUILD_CFLAGS = -g -O $(CSEARCH)
119
120LIBIBERTY_LIB = ../../libiberty/libiberty.a
121BFD_LIB = ../../bfd/libbfd.a
122OPCODES_LIB = ../../opcodes/libopcodes.a
123CONFIG_LIBS = @LIBS@
124LIBDEPS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
125 $(SIM_EXTRA_LIBDEPS)
126EXTRA_LIBS = $(BFD_LIB) $(OPCODES_LIB) $(LIBIBERTY_LIB) \
127 $(CONFIG_LIBS) $(SIM_EXTRA_LIBS)
128
129LIB_OBJS = callback.o targ-map.o $(SIM_OBJS)
130
131all: libsim.a run $(SIM_EXTRA_ALL)
132
133libsim.a: $(LIB_OBJS)
134 rm -f libsim.a
135 $(AR) $(ARFLAGS) libsim.a $(LIB_OBJS)
136 $(RANLIB) libsim.a
137
138run: $(SIM_RUN_OBJS) libsim.a $(LIBDEPS)
139 $(CC) $(ALL_CFLAGS) -o run \
140 $(SIM_RUN_OBJS) libsim.a $(EXTRA_LIBS)
141
142run.o: $(srcdir)/../common/run.c config.h tconfig.h \
143 $(srcroot)/include/callback.h
144 $(CC) -c $(srcdir)/../common/run.c $(ALL_CFLAGS)
145
146# FIXME: Ideally, callback.o and friends live in a library outside of
147# both the gdb and simulator source trees (e.g. devo/remote. Not
148# devo/libremote because this directory would contain more than just
149# a library).
150
151callback.o: $(srcdir)/../common/callback.c config.h tconfig.h \
152 $(srcroot)/include/callback.h targ-vals.h
153 $(CC) -c $(srcdir)/../common/callback.c $(ALL_CFLAGS)
154
155targ-map.o: targ-map.c targ-vals.h
156
157gentmap: Makefile $(srcdir)/../common/gentmap.c targ-vals.def
158 $(CC_FOR_BUILD) $(srcdir)/../common/gentmap.c -o gentmap $(BUILD_CFLAGS)
159
160targ-vals.h: gentmap
161 rm -f targ-vals.h
162 ./gentmap -h >targ-vals.h
163
164targ-map.c: gentmap
165 rm -f targ-map.c
166 ./gentmap -c >targ-map.c
167
168
169#
170# Rules for building sim-* components. Triggered by listing the corresponding
171# .o file in the list of simulator targets.
172#
173
174sim_main_headers = \
175 sim-main.h \
176 $(srcdir)/../common/sim-config.h \
177 $(srcdir)/../common/sim-base.h \
178 $(srcdir)/../common/sim-basics.h \
179 $(srcdir)/../common/sim-model.h \
180 $(srcdir)/../common/sim-module.h \
181 $(srcdir)/../common/sim-trace.h \
182 $(srcdir)/../common/sim-profile.h \
183 $(srcdir)/../common/sim-engine.h \
184 tconfig.h
185
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-engine_h = $(srcdir)/../common/sim-engine.h
195sim-events_h = $(srcdir)/../common/sim-events.h
196sim-fpu_h = $(srcdir)/../common/sim-fpu.h
197sim-io_h = $(srcdir)/../common/sim-io.h
198sim-options_h = $(srcdir)/../common/sim-options.h
199
200# FIXME: If this complicated way of building .o files from ../common is
201# necessary, the reason should be documented here.
202
203BUILT_SRC_FROM_COMMON= \
204 sim-endian.c \
205 sim-inline.c \
206 sim-bits.c \
207 sim-events.c \
208 sim-core.c \
209 sim-config.c \
210 sim-io.c
211
212sim-abort.o: sim-abort.c \
213 $(SIM_EXTRA_DEPS)
214sim-abort.c: $(srcdir)/../common/sim-abort.c
215 rm -f $@ tmp-$@
216 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
217 cat $(srcdir)/../common/$@ >> tmp-$@
218 $(srcdir)/../../move-if-change tmp-$@ $@
219
220sim-bits.o: sim-bits.c $(sim-bits_h) $(sim-n-bits_h) $(sim-assert_h) \
221 $(SIM_EXTRA_DEPS)
222sim-bits.c: $(srcdir)/../common/sim-bits.c
223 rm -f $@ tmp-$@
224 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
225 cat $(srcdir)/../common/$@ >> tmp-$@
226 $(srcdir)/../../move-if-change tmp-$@ $@
227
228sim-config.o: sim-config.c $(sim-config_h) $(sim-nconfig_h) $(sim-assert_h) \
229 $(SIM_EXTRA_DEPS)
230sim-config.c: $(srcdir)/../common/sim-config.c
231 rm -f $@ tmp-$@
232 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
233 cat $(srcdir)/../common/$@ >> tmp-$@
234 $(srcdir)/../../move-if-change tmp-$@ $@
235
236sim-core.o: sim-core.c $(sim-core_h) $(sim-n-core_h) \
237 $(SIM_EXTRA_DEPS)
238sim-core.c: $(srcdir)/../common/sim-core.c
239 rm -f $@ tmp-$@
240 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
241 cat $(srcdir)/../common/$@ >> tmp-$@
242 $(srcdir)/../../move-if-change tmp-$@ $@
243
244sim-endian.o: sim-endian.c $(sim-endian_h) $(sim-n-endian_h) $(sim-assert_h) \
245 $(SIM_EXTRA_DEPS)
246sim-endian.c: $(srcdir)/../common/sim-endian.c
247 rm -f $@ tmp-$@
248 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
249 cat $(srcdir)/../common/$@ >> tmp-$@
250 $(srcdir)/../../move-if-change tmp-$@ $@
251
252sim-engine.o: sim-engine.c $(sim_main_headers) $(sim-engine_h) $(sim-assert_h) \
253 $(SIM_EXTRA_DEPS)
254sim-engine.c: $(srcdir)/../common/sim-engine.c
255 rm -f $@ tmp-$@
256 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
257 cat $(srcdir)/../common/$@ >> tmp-$@
258 $(srcdir)/../../move-if-change tmp-$@ $@
259
260sim-events.o: sim-events.c $(sim-events_h) $(sim-assert_h) \
261 $(SIM_EXTRA_DEPS)
262sim-events.c: $(srcdir)/../common/sim-events.c
263 rm -f $@ tmp-$@
264 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
265 cat $(srcdir)/../common/$@ >> tmp-$@
266 $(srcdir)/../../move-if-change tmp-$@ $@
267
268sim-fpu.o: sim-fpu.c $(sim-fpu_h) $(sim-assert_h) \
269 $(SIM_EXTRA_DEPS)
270sim-fpu.c: $(srcdir)/../common/sim-fpu.c
271 rm -f $@ tmp-$@
272 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
273 cat $(srcdir)/../common/$@ >> tmp-$@
274 $(srcdir)/../../move-if-change tmp-$@ $@
275
276sim-inline.c: $(srcdir)/../common/sim-inline.c
277 rm -f $@ tmp-$@
278 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
279 cat $(srcdir)/../common/$@ >> tmp-$@
280 $(srcdir)/../../move-if-change tmp-$@ $@
281
282sim-io.o: sim-io.c $(sim_main_headers) $(sim-io_h) $(sim-assert_h) \
283 $(SIM_EXTRA_DEPS)
284sim-io.c: $(srcdir)/../common/sim-io.c
285 rm -f $@ tmp-$@
286 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
287 cat $(srcdir)/../common/$@ >> tmp-$@
288 $(srcdir)/../../move-if-change tmp-$@ $@
289
290sim-module.o: $(srcdir)/../common/sim-module.c $(sim_main_headers) \
291 $(sim-io_h) $(SIM_EXTRA_DEPS)
292 $(CC) -c $(srcdir)/../common/sim-module.c $(ALL_CFLAGS)
293
294sim-options.o: $(srcdir)/../common/sim-options.c $(sim_main_headers) \
295 $(sim-options_h) $(sim-io_h) $(SIM_EXTRA_DEPS)
296 $(CC) -c $(srcdir)/../common/sim-options.c $(ALL_CFLAGS)
297
298sim-reason.o: sim-reason.c $(sim_main_headers) $(sim-assert_h) \
299 $(SIM_EXTRA_DEPS)
300sim-reason.c: $(srcdir)/../common/sim-reason.c
301 rm -f $@ tmp-$@
302 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
303 cat $(srcdir)/../common/$@ >> tmp-$@
304 $(srcdir)/../../move-if-change tmp-$@ $@
305
306sim-resume.o: sim-resume.c $(sim_main_headers) $(sim-assert_h) \
307 $(SIM_EXTRA_DEPS)
308sim-resume.c: $(srcdir)/../common/sim-resume.c
309 rm -f $@ tmp-$@
310 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
311 cat $(srcdir)/../common/$@ >> tmp-$@
312 $(srcdir)/../../move-if-change tmp-$@ $@
313
314sim-run.o: sim-run.c $(sim_main_headers) $(sim-assert_h) \
315 $(SIM_EXTRA_DEPS)
316sim-run.c: $(srcdir)/../common/sim-run.c
317 rm -f $@ tmp-$@
318 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
319 cat $(srcdir)/../common/$@ >> tmp-$@
320 $(srcdir)/../../move-if-change tmp-$@ $@
321
322sim-stop.o: sim-stop.c $(sim_main_headers) $(sim-assert_h) \
323 $(SIM_EXTRA_DEPS)
324sim-stop.c: $(srcdir)/../common/sim-stop.c
325 rm -f $@ tmp-$@
326 echo "# 1 \"$(srcdir)/../common/$@\"" > tmp-$@
327 cat $(srcdir)/../common/$@ >> tmp-$@
328 $(srcdir)/../../move-if-change tmp-$@ $@
329
330sim-trace.o: $(srcdir)/../common/sim-trace.c $(sim_main_headers) \
331 $(sim-options_h) $(sim-io_h) $(SIM_EXTRA_DEPS)
332 $(CC) -c $(srcdir)/../common/sim-trace.c $(ALL_CFLAGS)
333
334sim-profile.o: $(srcdir)/../common/sim-profile.c $(sim_main_headers) \
335 $(sim-options_h) $(sim-io_h) $(SIM_EXTRA_DEPS)
336 $(CC) -c $(srcdir)/../common/sim-profile.c $(ALL_CFLAGS)
337
338sim-model.o: $(srcdir)/../common/sim-model.c $(sim_main_headers) \
339 $(sim-io_h) $(SIM_EXTRA_DEPS)
340 $(CC) -c $(srcdir)/../common/sim-model.c $(ALL_CFLAGS)
341
342sim-utils.o: $(srcdir)/../common/sim-utils.c $(sim_main_headers) \
343 $(SIM_EXTRA_DEPS)
344 $(CC) -c $(srcdir)/../common/sim-utils.c $(ALL_CFLAGS)
345
346sim-load.o: $(srcdir)/../common/sim-load.c
347 $(CC) -c $(srcdir)/../common/sim-load.c $(ALL_CFLAGS)
348
349nrun.o: $(srcdir)/../common/nrun.c config.h tconfig.h \
350 $(srcroot)/include/callback.h $(sim_main_headers)
351 $(CC) -c $(srcdir)/../common/nrun.c $(ALL_CFLAGS)
352
353# CGEN support.
354
355cgen-scache.o: $(srcdir)/../common/cgen-scache.c $(sim_main_headers) \
356 $(SIM_EXTRA_DEPS) $(srcdir)/../common/cgen-scache.h
357 $(CC) -c $(srcdir)/../common/cgen-scache.c $(ALL_CFLAGS)
358
359cgen-trace.o: $(srcdir)/../common/cgen-trace.c $(sim_main_headers) \
360 $(SIM_EXTRA_DEPS) $(srcdir)/../common/cgen-trace.h
361 $(CC) -c $(srcdir)/../common/cgen-trace.c $(ALL_CFLAGS)
362
363cgen-utils.o: $(srcdir)/../common/cgen-utils.c $(sim_main_headers) \
364 $(SIM_EXTRA_DEPS) mem-ops.h sem-ops.h
365 $(CC) -c $(srcdir)/../common/cgen-utils.c $(ALL_CFLAGS)
366
367# Support targets.
368
369install: install-common $(SIM_EXTRA_INSTALL)
370
371install-common: installdirs
372 n=`echo run | sed '$(program_transform_name)'`; \
373 $(INSTALL_PROGRAM) run $(bindir)/$$n
374
375installdirs:
376 $(SHELL) $(srcdir)/../../mkinstalldirs $(bindir)
377
378check:
379
380info:
381clean-info:
382install-info:
383
384.NOEXPORT:
385MAKEOVERRIDES=
386
387tags etags: TAGS
388
389TAGS: force
390 etags *.c *.h
391
392clean: $(SIM_EXTRA_CLEAN)
393 rm -f *.[oa] *~ core
394 rm -f run libsim.a
395 rm -f gentmap targ-map.c targ-vals.h
396 rm -f $(BUILT_SRC_FROM_COMMON)
397
398distclean mostlyclean maintainer-clean realclean: clean
399 rm -f TAGS
400 rm -f Makefile config.cache config.log config.status
401 rm -f tconfig.h config.h stamp-h
402 rm -f targ-vals.def
403
404.c.o:
405 $(CC) -c $(ALL_CFLAGS) $<
406
407# Dummy target to force execution of dependent targets.
408force:
409
410Makefile: Makefile.in $(srcdir)/../common/Make-common.in config.status
411 CONFIG_HEADERS= $(SHELL) ./config.status
412
413config.status: configure
414 $(SHELL) ./config.status --recheck
415
416config.h: stamp-h ; @true
417stamp-h: config.in config.status
418 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
419
420## End COMMON_POST_CONFIG_FRAG
This page took 0.023414 seconds and 4 git commands to generate.