Latest cagney update
[binutils-gdb.git] / sim / ppc / Makefile.in
1 #
2 # This file is part of the program psim.
3 #
4 # Copyright (C) 1994-1995, Andrew Cagney <cagney@highland.com.au>
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #
20
21 default: all
22
23 VPATH = @srcdir@
24 srcdir = @srcdir@
25 srcroot = $(srcdir)/../..
26
27 prefix = @prefix@
28 exec_prefix = @exec_prefix@
29
30 host_alias = @host_alias@
31 target_alias = @target_alias@
32 program_transform_name = @program_transform_name@
33 bindir = $(exec_prefix)/bin
34 libdir = $(exec_prefix)/lib
35 tooldir = $(libdir)/$(target_alias)
36
37 datadir = $(prefix)/lib
38 mandir = $(prefix)/man
39 man1dir = $(mandir)/man1
40 man2dir = $(mandir)/man2
41 man3dir = $(mandir)/man3
42 man4dir = $(mandir)/man4
43 man5dir = $(mandir)/man5
44 man6dir = $(mandir)/man6
45 man7dir = $(mandir)/man7
46 man8dir = $(mandir)/man8
47 man9dir = $(mandir)/man9
48 infodir = $(prefix)/info
49 includedir = $(prefix)/include
50 docdir = $(datadir)/doc
51
52 SHELL = /bin/sh
53
54 INSTALL = $(srcroot)/install.sh -c
55 INSTALL_PROGRAM = $(INSTALL)
56 INSTALL_DATA = $(INSTALL)
57 INSTALL_XFORM = $(INSTALL) -t='$(program_transform_name)'
58 INSTALL_XFORM1= $(INSTALL_XFORM) -b=.1
59
60 AR = @AR@
61 AR_FLAGS = rc
62 CC = @CC@
63 CFLAGS = @CFLAGS@
64 CC_FOR_BUILD = @CC_FOR_BUILD@
65 BISON = bison
66 MAKEINFO = makeinfo
67 RANLIB = @RANLIB@
68
69 SIM_CFLAGS = @sim_cflags@
70 INLINE_CFLAGS = @sim_inline@
71 BSWAP_CFLAGS = @sim_bswap@
72 ENDIAN_CFLAGS = @sim_endian@
73 HOSTENDIAN_CFLAGS = @sim_hostendian@
74 SMP_CFLAGS = @sim_smp@
75 XOR_ENDIAN_CFLAGS = @sim_xor_endian@
76 BITSIZE_CFLAGS = @sim_bitsize@
77 HOSTBITSIZE_CFLAGS = @sim_hostbitsize@
78 ENV_CFLAGS = @sim_env@
79 TIMEBASE_CFLAGS = @sim_timebase@
80 ALIGNMENT_CFLAGS = @sim_alignment@
81 FLOAT_CFLAGS = @sim_float@
82 TRACE_CFLAGS = @sim_trace@
83 ASSERT_CFLAGS = @sim_assert@
84 RESERVED_CFLAGS = @sim_reserved@
85 MONITOR_CFLAGS = @sim_monitor@
86 MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
87 WARNING_CFLAGS = @sim_warnings@
88 CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
89 $(ENDIAN_CFLAGS) \
90 $(HOSTENDIAN_CFLAGS) \
91 $(SMP_CFLAGS) \
92 $(XOR_ENDIAN_CFLAGS) \
93 $(BITSIZE_CFLAGS) \
94 $(HOSTBITSIZE_CFLAGS) \
95 $(ENV_CFLAGS) \
96 $(TIMEBASE_CFLAGS) \
97 $(ALIGNMENT_CFLAGS) \
98 $(FLOAT_CFLAGS) \
99 $(TRACE_CFLAGS) \
100 $(ASSERT_CFLAGS) \
101 $(RESERVED_CFLAGS) \
102 $(MONITOR_CFLAGS) \
103 $(MODEL_CFLAGS)
104
105 STD_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
106 NOWARN_CFLAGS = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)
107
108 CONFIG_FILE = @sim_config@
109 IGEN_OPCODE_RULES = @sim_opcode@
110 IGEN_DUPLICATE = @sim_dup@
111 IGEN_FILTER = @sim_filter@
112 IGEN_ICACHE = @sim_icache@
113 DGEN_FLAGS = @sim_switch@
114
115 HDEFINES = @HDEFINES@
116 TDEFINES =
117 IGEN_FLAGS = $(IGEN_DUPLICATE) $(IGEN_FILTER) $(IGEN_ICACHE)
118
119 .NOEXPORT:
120 MAKEOVERRIDES=
121
122 LIB_INCLUDES = -I$(srcdir)/../../include
123 BFD_INCLUDES = -I../../bfd -I$(srcdir)/../../bfd
124 GDB_INCLUDES = -I../../gdb -I$(srcdir)/../../gdb -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
125 INCLUDES = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
126
127 LIBIBERTY_LIB = ../../libiberty/libiberty.a
128 BFD_LIB = ../../bfd/libbfd.a
129
130 TARGETLIB = libsim.a
131
132 all: run $(TARGETLIB) $(GDB_OBJ)
133
134 .c.o:
135 $(CC) -c $(STD_CFLAGS) $<
136
137
138
139 BASICS_H = \
140 basics.h \
141 config.h \
142 ppc-config.h \
143 inline.h \
144 sim_callbacks.h \
145 debug.h filter_filename.h \
146 words.h \
147 bits.h \
148 sim-endian.h
149
150 PSIM_H = \
151 psim.h \
152 $(BASICS_H)
153
154 IDECODE_H = \
155 idecode.h \
156 idecode_expression.h \
157 idecode_branch.h \
158 idecode_fields.h \
159 icache.h
160
161 REGISTERS_H = \
162 registers.h \
163 spreg.h
164
165 CPU_H = \
166 cpu.h \
167 $(BASICS_H) \
168 $(REGISTERS_H) \
169 device.h \
170 corefile.h \
171 vm.h \
172 events.h \
173 interrupts.h \
174 psim.h \
175 icache.h \
176 itable.h \
177 mon.h \
178 model.h
179
180 DEVICE_TABLE_H = \
181 $(BASICS_H) \
182 device_table.h \
183 device.h
184
185 EMUL_GENERIC_H = \
186 $(CPU_H) \
187 $(IDECODE_H) \
188 emul_generic.h \
189 os_emul.h
190
191
192 INLINE = \
193 inline.h \
194 inline.c
195
196 BUILT_SRC_WO_CONFIG = \
197 icache.h \
198 idecode.h idecode.c \
199 semantics.h semantics.c \
200 itable.h itable.c \
201 spreg.h spreg.c \
202 model.h model.c
203
204 BUILT_SRC = \
205 $(BUILT_SRC_WO_CONFIG) \
206 config.h \
207 ppc-config.h
208
209 LIB_SRC = \
210 psim.c \
211 bits.c \
212 debug.c \
213 sim-endian.c \
214 sim-endian.h \
215 sim-endian-n.h \
216 vm.c \
217 vm_n.h \
218 corefile.c \
219 events.c \
220 os_emul.c \
221 emul_generic.c \
222 emul_netbsd.c \
223 emul_chirp.c \
224 emul_bugapi.c \
225 registers.c \
226 cpu.c \
227 interrupts.c \
228 device.c \
229 device_table.c \
230 cap.c \
231 mon.c \
232 options.c
233
234 MAIN_SRC = \
235 main.c \
236 sim_calls.c
237
238
239 # NOTE: semantics, idecode and psim put last so smaller files are compiled
240 # first
241 LIB_OBJ = \
242 debug.o \
243 filter_filename.o \
244 bits.o \
245 sim-endian.o \
246 os_emul.o \
247 emul_generic.o \
248 emul_netbsd.o \
249 emul_chirp.o \
250 emul_bugapi.o \
251 registers.o \
252 vm.o \
253 corefile.o \
254 model.o \
255 spreg.o \
256 cpu.o \
257 interrupts.o \
258 events.o \
259 cap.o \
260 device.o \
261 device_table.o \
262 itable.o \
263 mon.o \
264 semantics.o \
265 idecode.o \
266 psim.o \
267 options.o
268
269
270 GDB_OBJ = sim_calls.o
271
272
273 psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS)
274 $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim main.o $(TARGETLIB) $(BFD_LIB) $(LIBIBERTY_LIB) $(LIBS)
275
276 run: psim
277 rm -f run
278 ln psim run
279
280 $(TARGETLIB): tmp-igen tmp-dgen $(LIB_OBJ) $(GDB_OBJ)
281 rm -f $(TARGETLIB)
282 $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
283 $(RANLIB) $(TARGETLIB)
284
285 # Given that inlines are turned on now, rebuild psim whenever
286 # anything changes.
287 psim.o: psim.c psim.h $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC)
288
289 bits.o: bits.c $(BASICS_H)
290
291 debug.o: debug.c $(BASICS_H)
292 filter_filename.o: filter_filename.c filter_filename.h config.h ppc-config.h
293
294 sim-endian.o: sim-endian.c sim-endian-n.h $(BASICS_H)
295
296 os_emul.o: os_emul.c emul_netbsd.h emul_chirp.h emul_bugapi.h $(EMUL_GENERIC_H)
297 emul_generic.o: emul_generic.c $(EMUL_GENERIC_H)
298
299 emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H)
300 emul_chirp.o: emul_chirp.c emul_chirp.h cap.h $(EMUL_GENERIC_H)
301 emul_bugapi.o: emul_bugapi.c emul_bugapi.h $(EMUL_GENERIC_H)
302
303 registers.o: registers.c $(REGISTERS_H) $(BASICS_H)
304
305 cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
306
307 interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h
308
309 idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h
310 $(CC) -c $(NOWARN_CFLAGS) $<
311
312 # double.o: double.c dp-bit.c
313
314 vm.o: vm.c vm.h vm_n.h $(BASICS_H) $(REGISTERS_H) \
315 device.h corefile.h interrupts.h itable.h mon.h
316
317 corefile.o: corefile.c corefile.h corefile-n.h $(BASICS_H) device.h
318
319 model.o: model.c $(CPU_H)
320
321 events.o: events.c events.h $(BASICS_H)
322
323 sim_calls.o: sim_calls.c $(PSIM_H) itable.h ../../gdb/tm.h options.h
324
325 spreg.o: spreg.h spreg.c $(BASICS_H)
326
327 main.o: main.c $(PSIM_H) itable.h options.h
328
329 device.o: device.c $(DEVICE_TABLE_H)
330
331 device_table.o: device_table.c $(DEVICE_TABLE_H) events.h
332
333 cap.o: cap.c cap.h $(BASICS_H)
334
335 semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
336 $(CC) -c $(NOWARN_CFLAGS) $<
337
338 itable.o: itable.c itable.h
339
340 mon.o: mon.c $(CPU_H)
341
342 # Rebuild options whenever something changes so the date/time is up to date.
343 options.o: options.c $(BASICS_H) $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile
344 $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $<
345
346 #
347 # Rules to create the built c source code files
348 #
349
350 ppc-config.h: $(CONFIG_FILE)
351 cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
352
353
354 tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
355 ./dgen $(DGEN_FLAGS) \
356 -r $(srcdir)/ppc-spr-table \
357 -n spreg.h -P tmp-spreg.h \
358 -n spreg.c -p tmp-spreg.c
359 $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
360 $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
361 touch tmp-dgen
362
363
364 tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) ppc-cache-rules $(srcdir)/../../move-if-change
365 ./igen $(IGEN_FLAGS) \
366 -o $(srcdir)/$(IGEN_OPCODE_RULES) \
367 -k $(srcdir)/ppc-cache-rules \
368 -i $(srcdir)/ppc-instructions \
369 -n icache.h -C tmp-icache.h \
370 -n semantics.h -S tmp-semantics.h \
371 -n semantics.c -s tmp-semantics.c \
372 -n idecode.h -D tmp-idecode.h \
373 -n idecode.c -d tmp-idecode.c \
374 -n itable.h -T tmp-itable.h \
375 -n itable.c -t tmp-itable.c \
376 -n model.h -M tmp-model.h \
377 -n model.c -m tmp-model.c
378 $(srcdir)/../../move-if-change tmp-icache.h icache.h
379 $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
380 $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
381 $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
382 $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
383 $(srcdir)/../../move-if-change tmp-itable.h itable.h
384 $(srcdir)/../../move-if-change tmp-itable.c itable.c
385 $(srcdir)/../../move-if-change tmp-model.h model.h
386 $(srcdir)/../../move-if-change tmp-model.c model.c
387 touch tmp-igen
388
389 # NOTE: Some versions of make don't handle files created as side-effects
390 # uncomment the below if that is the case.
391
392 $(TARGETLIB): tmp-igen tmp-dgen
393 itable.h itable.c icache.h idecode.h idecode.c semantics.h semantics.c model.h model.c: tmp-igen
394 spreg.h spreg.c: tmp-dgen
395
396 dgen: dgen.o table.o lf.o misc.o filter_filename.o
397 $(CC_FOR_BUILD) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS)
398
399 igen: igen.o table.o lf.o misc.o filter_filename.o
400 $(CC_FOR_BUILD) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_filename.o $(LIBIBERTY_LIB) $(LIBS)
401
402 table.o: misc.h filter_filename.h lf.h table.h
403 lf.o: misc.h filter_filename.h lf.h
404 dgen.o igen.o: misc.h filter_filename.h lf.h table.h
405 misc.o: misc.h filter_filename.h
406 # With out this #, make thinks that misc.o doesn't have a rule
407
408 tags etags: TAGS
409
410 TAGS: $(BUILT_SRC)
411 etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
412
413 clean mostlyclean:
414 rm -f tmp-* *.[oasi] core psim run igen dgen config.log $(BUILT_SRC_WO_CONFIG)
415
416 distclean realclean: clean
417 rm -f TAGS Makefile config.cache config.status config.h stamp-h
418
419 maintainer-clean: distclean
420 rm -f *~ ppc-config.h
421
422 Makefile: Makefile.in config.status
423 CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
424
425 config.h: stamp-h ; @true
426 stamp-h: config.in config.status
427 CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
428
429 config.status: configure
430 $(SHELL) ./config.status --recheck
431
432 install:
433 $(INSTALL_XFORM) run $(bindir)/run
434