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