2003-06-19 Andrew Cagney <cagney@redhat.com>
[external/binutils.git] / sim / ppc / Makefile.in
1 #
2 #   This file is part of the program psim.
3 #
4 #   Copyright 1994, 1995, 1996, 1997, 2003 Andrew Cagney
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 = @bindir@
34 libdir = @libdir@
35 tooldir = $(libdir)/$(target_alias)
36
37 datadir = @datadir@
38 mandir = @mandir@
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 = @infodir@
49 includedir = @includedir@
50
51 # This can be referenced by the gettext configuration code.
52 top_builddir = ..
53
54 EXEEXT = @EXEEXT@
55 SHELL = /bin/sh
56
57 INSTALL = @INSTALL@
58 INSTALL_PROGRAM = @INSTALL_PROGRAM@
59 INSTALL_DATA = @INSTALL_DATA@
60
61 AR = @AR@
62 AR_FLAGS = rc
63 CC = @CC@
64 CFLAGS = @CFLAGS@
65 CC_FOR_BUILD = @CC_FOR_BUILD@
66 BISON = bison
67 MAKEINFO = makeinfo
68 RANLIB = @RANLIB@
69
70 SIM_CFLAGS = @sim_cflags@
71 INLINE_CFLAGS = @sim_inline@
72 BSWAP_CFLAGS = @sim_bswap@
73 ENDIAN_CFLAGS = @sim_endian@
74 REGPARM_CFLAGS = @sim_regparm@
75 STDCALL_CFLAGS = @sim_stdcall@
76 HOSTENDIAN_CFLAGS = @sim_hostendian@
77 SMP_CFLAGS = @sim_smp@
78 XOR_ENDIAN_CFLAGS = @sim_xor_endian@
79 BITSIZE_CFLAGS = @sim_bitsize@
80 HOSTBITSIZE_CFLAGS = @sim_hostbitsize@
81 ENV_CFLAGS = @sim_env@
82 TIMEBASE_CFLAGS = @sim_timebase@
83 ALIGNMENT_CFLAGS = @sim_alignment@
84 FLOAT_CFLAGS = @sim_float@
85 TRACE_CFLAGS = @sim_trace@
86 ASSERT_CFLAGS = @sim_assert@
87 RESERVED_CFLAGS = @sim_reserved@
88 MONITOR_CFLAGS = @sim_monitor@
89 MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
90 STDIO_CFLAGS = @sim_stdio@
91 TERMIO_CFLAGS = @sim_termio@
92 WARNING_CFLAGS = @sim_warnings@
93 DEVZERO_CFLAGS = @sim_devzero@
94 CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
95   $(ENDIAN_CFLAGS) \
96   $(REGPARM_CFLAGS) \
97   $(STDCALL_CFLAGS) \
98   $(HOSTENDIAN_CFLAGS) \
99   $(SMP_CFLAGS) \
100   $(XOR_ENDIAN_CFLAGS) \
101   $(BITSIZE_CFLAGS) \
102   $(HOSTBITSIZE_CFLAGS) \
103   $(ENV_CFLAGS) \
104   $(TIMEBASE_CFLAGS) \
105   $(ALIGNMENT_CFLAGS) \
106   $(FLOAT_CFLAGS) \
107   $(TRACE_CFLAGS) \
108   $(ASSERT_CFLAGS) \
109   $(RESERVED_CFLAGS) \
110   $(MONITOR_CFLAGS) \
111   $(MODEL_CFLAGS) \
112   $(STDIO_CFLAGS) \
113   $(TERMIO_CFLAGS) \
114   $(DEVZERO_CFLAGS)
115 SIM_FPU_CFLAGS = @sim_fpu_cflags@
116
117 STD_CFLAGS      = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS)
118 NOWARN_CFLAGS   = $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)  $(SIM_FPU_CFLAGS)
119 BUILD_CFLAGS    = -g -O $(INCLUDES) $(WARNING_CFLAGS)
120
121 BUILD_LDFLAGS   =
122
123 CONFIG_FILE = @sim_config@
124 IGEN_OPCODE_RULES = @sim_opcode@
125 IGEN_DECODE_MECHANISM = @sim_decode_mechanism@
126 IGEN_DUPLICATE = @sim_dup@
127 IGEN_JUMP = @sim_jump@
128 IGEN_FILTER = @sim_filter@
129 IGEN_ICACHE = @sim_icache@
130 IGEN_SMP = @sim_igen_smp@
131 IGEN_LINE_NR = @sim_line_nr@
132 DGEN_FLAGS = @sim_switch@
133
134 HDEFINES = @HDEFINES@
135 TDEFINES =
136 IGEN_FLAGS = \
137         $(IGEN_DECODE_MECHANISM) \
138         $(IGEN_DUPLICATE) \
139         $(IGEN_JUMP) \
140         $(IGEN_FILTER) \
141         $(IGEN_ICACHE) \
142         $(IGEN_SMP) \
143         $(IGEN_LINE_NR)
144
145 .NOEXPORT:
146 MAKEOVERRIDES=
147
148 LIB_INCLUDES    = -I$(srcdir)/../../include
149 BFD_INCLUDES    = -I../../bfd -I$(srcdir)/../../bfd
150 GDB_INCLUDES    = -I../../gdb -I$(srcdir)/../../gdb  -I$(srcdir)/../../gdb/config -I$(srcdir)/../../mmalloc
151
152 INCLUDES        = -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
153
154 LIBIBERTY_LIB   = ../../libiberty/libiberty.a
155 BFD_LIB         = ../../bfd/libbfd.a
156
157 INTLLIBS = @INTLLIBS@
158 INTLDEPS = @INTLDEPS@
159 INTL_DIR = ../../intl
160 INTL_SRC = $(srcdir)/$(INTL_DIR)
161 INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC)
162
163
164 TARGETLIB       = libsim.a
165
166 all:    run $(TARGETLIB) $(GDB_OBJ)
167
168 .c.o:
169         $(CC) -c $(STD_CFLAGS) $<
170
171
172
173 BASICS_H = \
174         basics.h \
175         config.h \
176         ppc-config.h \
177         inline.h \
178         sim_callbacks.h \
179         debug.h filter_filename.h \
180         words.h \
181         bits.h \
182         sim-endian.h
183
184 PSIM_H = \
185         psim.h \
186         $(BASICS_H)
187
188 IDECODE_H = \
189         idecode.h \
190         idecode_expression.h \
191         idecode_branch.h \
192         idecode_fields.h \
193         icache.h
194
195 REGISTERS_H = \
196         registers.h \
197         spreg.h
198
199 CPU_H = \
200         cpu.h \
201         $(BASICS_H) \
202         $(REGISTERS_H) \
203         $(IDECODE_H) \
204         device.h \
205         corefile.h \
206         vm.h \
207         events.h \
208         interrupts.h \
209         psim.h \
210         itable.h \
211         mon.h \
212         model.h
213
214 DEVICE_TABLE_H = \
215         $(BASICS_H) \
216         device_table.h \
217         device.h \
218         tree.h \
219         hw.h
220
221 EMUL_GENERIC_H = \
222         $(CPU_H) \
223         $(IDECODE_H) \
224         emul_generic.h \
225         tree.h \
226         os_emul.h
227
228
229 INLINE = \
230         inline.h \
231         inline.c
232
233 BUILT_SRC_WO_CONFIG = \
234         icache.h icache.c \
235         support.h support.c \
236         idecode.h idecode.c \
237         semantics.h semantics.c \
238         itable.h itable.c \
239         spreg.h spreg.c \
240         model.h model.c \
241         support.h support.c \
242         pk.h \
243         hw.h hw.c \
244         filter_host.c \
245         @sim_targ_vals@
246
247 BUILT_SRC = \
248         $(BUILT_SRC_WO_CONFIG) \
249         config.h \
250         ppc-config.h 
251
252 LIB_INLINE_SRC = \
253         psim.c \
254         bits.c \
255         debug.c \
256         sim-endian.c \
257         sim-endian.h \
258         sim-endian-n.h \
259         vm.c \
260         vm_n.h \
261         corefile.c \
262         events.c \
263         os_emul.c \
264         registers.c \
265         cpu.c \
266         interrupts.c \
267         device.c \
268         tree.c \
269         device_table.c \
270         cap.c \
271         mon.c \
272         options.c
273
274 LIB_SRC = \
275         $(PACKAGE_SRC) \
276         $(HW_SRC) \
277         $(LIB_INLINE_SRC)
278
279 MAIN_SRC = \
280         main.c \
281         sim_calls.c
282
283
284 # NOTE: semantics, idecode and psim put last so smaller files are compiled
285 #       first
286 LIB_OBJ = \
287         debug.o \
288         filter_filename.o \
289         bits.o \
290         sim-endian.o \
291         os_emul.o \
292         emul_generic.o \
293         emul_bugapi.o \
294         emul_chirp.o \
295         emul_netbsd.o \
296         emul_unix.o \
297         registers.o \
298         vm.o \
299         corefile.o \
300         model.o \
301         spreg.o \
302         cpu.o \
303         interrupts.o \
304         events.o \
305         cap.o \
306         device.o \
307         tree.o \
308         device_table.o \
309         itable.o \
310         mon.o \
311         icache.o \
312         semantics.o \
313         idecode.o \
314         support.o \
315         @sim_fpu@ \
316         psim.o \
317         $(PACKAGE_OBJ) \
318         $(HW_OBJ) \
319         options.o
320
321
322 GDB_OBJ = sim_calls.o @sim_callback@
323
324 HW_SRC = @sim_hw_src@
325 HW_OBJ = @sim_hw_obj@
326
327 PACKAGE_SRC = @sim_pk_src@
328 PACKAGE_OBJ = @sim_pk_obj@
329
330
331 psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS) $(INTLDEPS)
332         $(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(INTLLIBS) $(LIBIBERTY_LIB) $(LIBS)
333
334 run: psim
335         rm -f run$(EXEEXT)
336         ln psim$(EXEEXT) run$(EXEEXT)
337
338 $(TARGETLIB): tmp-igen tmp-dgen tmp-hw tmp-pk tmp-defines $(LIB_OBJ) $(GDB_OBJ)
339         rm -f $(TARGETLIB)
340         $(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
341         $(RANLIB) $(TARGETLIB)
342
343 psim.o: psim.c psim.h tree.h $(CPU_H) $(IDECODE_H)
344
345 bits.o: bits.c $(BASICS_H)
346
347 debug.o: debug.c $(BASICS_H)
348 filter_filename.o: filter_filename.c filter_filename.h config.h ppc-config.h
349
350 sim-endian.o: sim-endian.c sim-endian-n.h $(BASICS_H)
351
352 os_emul.o: os_emul.c emul_netbsd.h emul_unix.h emul_chirp.h emul_bugapi.h $(EMUL_GENERIC_H)
353 emul_generic.o: emul_generic.c $(EMUL_GENERIC_H)
354
355 emul_bugapi.o: emul_bugapi.c emul_bugapi.h $(EMUL_GENERIC_H)
356 emul_chirp.o: emul_chirp.c emul_chirp.h $(EMUL_GENERIC_H)
357 emul_netbsd.o: emul_netbsd.c emul_netbsd.h $(EMUL_GENERIC_H)
358 emul_unix.o: emul_unix.c emul_unix.h $(EMUL_GENERIC_H)
359
360 registers.o: registers.c $(REGISTERS_H) $(BASICS_H) 
361
362 cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
363
364 interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) os_emul.h
365
366 # Given that inlines are turned on now, rebuild idecode whenever
367 # anything changes.
368 idecode.o: idecode.c $(CPU_H) $(IDECODE_H) semantics.h $(LIB_INLINE_SRC) $(BUILT_SRC)
369
370 # double.o: double.c dp-bit.c
371
372 vm.o: vm.c vm.h vm_n.h $(CPU_H)
373
374 corefile.o: corefile.c corefile.h corefile-n.h $(BASICS_H) $(DEVICE_TABLE_H)
375
376 model.o: model.c $(CPU_H)
377
378 events.o: events.c events.h $(BASICS_H) 
379
380 sim_calls.o: sim_calls.c $(PSIM_H) itable.h ../../gdb/tm.h options.h
381
382 spreg.o: spreg.c spreg.h spreg.c $(BASICS_H)
383
384 main.o: main.c $(PSIM_H) itable.h options.h
385
386 device.o: device.c $(DEVICE_TABLE_H) cap.h
387
388 tree.o: tree.c tree.h device.h $(DEVICE_TABLE_H)
389
390 device_table.o: device_table.c $(DEVICE_TABLE_H) events.h hw.c
391
392 cap.o: cap.c cap.h $(BASICS_H)
393
394 semantics.o: semantics.c semantics.h $(CPU_H) $(IDECODE_H)
395
396 icache.o: icache.c icache.h $(IDECODE_H) $(CPU_H)
397
398 support.o: support.c support.h $(IDECODE_H) $(CPU_H)
399
400 itable.o: itable.c itable.h
401
402 mon.o: mon.c $(CPU_H)
403
404 # GDB after 4.16 expects the default_callback structure to be setup.
405 # As a kludge, build the common stuff here for now.
406 gentmap: ../common/gentmap.c Makefile targ-vals.def
407         $(CC_FOR_BUILD) $(BUILD_FLAGS) -I. -I../common -I$(srcdir)/../common -o gentmap $< $(BUILD_LIBS)
408
409 targ-vals.def: $(srcdir)/../common/nltvals.def
410         rm -f targ-vals.def tmp-def
411         cat $(srcdir)/../common/nltvals.def > tmp-vals.def
412         $(SHELL) $(srcdir)/../../move-if-change tmp-vals.def targ-vals.def
413
414 targ-vals.h: Makefile gentmap $(srcdir)/../../move-if-change
415         rm -f tmp-vals.h
416         ./gentmap -h > tmp-vals.h
417         $(SHELL) $(srcdir)/../../move-if-change tmp-vals.h targ-vals.h
418
419 targ-map.c: Makefile gentmap $(srcdir)/../../move-if-change
420         rm -f tmp-map.c
421         ./gentmap -c > tmp-map.c
422         $(SHELL) $(srcdir)/../../move-if-change tmp-map.c targ-map.c
423
424 callback.o: ../common/callback.c targ-vals.h config.h
425         $(CC) -c $(STD_CFLAGS) -DHAVE_CONFIG_H $<
426
427 targ-map.o: targ-map.c targ-vals.h
428
429 sim-fpu.o: $(srcdir)/../common/sim-fpu.c config.h tconfig.h
430         $(CC) -c $(STD_CFLAGS) -DHAVE_CONFIG_H $(srcdir)/../common/sim-fpu.c 
431
432 tconfig.h:
433         rm -f tconfig.h
434         echo > tconfig.h
435
436 # Rebuild options whenever something changes so the date/time is up to date.
437 options.o: options.c $(BASICS_H) $(CPU_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile defines.h
438         $(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $<
439
440 tmp-defines: config.h Makefile
441         sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > tmp-defines.h
442         $(SHELL) $(srcdir)/../../move-if-change tmp-defines.h defines.h
443         touch tmp-defines
444
445 #
446 # Rules to create the built c source code files
447 #
448
449 ppc-config.h: $(CONFIG_FILE)
450         cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
451
452
453 tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
454         ./dgen $(DGEN_FLAGS) \
455                 -r $(srcdir)/ppc-spr-table \
456                 -n spreg.h -hp tmp-spreg.h \
457                 -n spreg.c -p  tmp-spreg.c
458         $(SHELL) $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
459         $(SHELL) $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
460         touch tmp-dgen
461
462
463 tmp-igen: igen ppc-instructions $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
464         ./igen  $(IGEN_FLAGS) \
465                 -o $(srcdir)/$(IGEN_OPCODE_RULES) \
466                 -I $(srcdir) -i $(srcdir)/ppc-instructions \
467                 -n icache.h    -hc tmp-icache.h \
468                 -n icache.c    -c  tmp-icache.c \
469                 -n semantics.h -hs tmp-semantics.h \
470                 -n semantics.c -s  tmp-semantics.c \
471                 -n idecode.h   -hd tmp-idecode.h \
472                 -n idecode.c   -d  tmp-idecode.c \
473                 -n itable.h    -ht tmp-itable.h \
474                 -n itable.c    -t  tmp-itable.c \
475                 -n model.h     -hm tmp-model.h \
476                 -n model.c     -m  tmp-model.c \
477                 -n support.h   -hf tmp-support.h \
478                 -n support.c   -f  tmp-support.c
479         $(SHELL) $(srcdir)/../../move-if-change tmp-icache.h icache.h
480         $(SHELL) $(srcdir)/../../move-if-change tmp-icache.c icache.c
481         $(SHELL) $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
482         $(SHELL) $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
483         $(SHELL) $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
484         $(SHELL) $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
485         $(SHELL) $(srcdir)/../../move-if-change tmp-itable.h itable.h
486         $(SHELL) $(srcdir)/../../move-if-change tmp-itable.c itable.c
487         $(SHELL) $(srcdir)/../../move-if-change tmp-model.h model.h
488         $(SHELL) $(srcdir)/../../move-if-change tmp-model.c model.c
489         $(SHELL) $(srcdir)/../../move-if-change tmp-support.h support.h
490         $(SHELL) $(srcdir)/../../move-if-change tmp-support.c support.c
491         touch tmp-igen
492
493 # NOTE: Some versions of make don't handle files created as side-effects
494 # uncomment the below if that is the case.
495
496 $(TARGETLIB): tmp-igen tmp-dgen
497 itable.h itable.c icache.h icache.c idecode.h idecode.c semantics.h semantics.c model.h model.c support.h support.c: tmp-igen
498 spreg.h spreg.c: tmp-dgen
499
500 dgen: dgen.o table.o lf.o misc.o filter_host.o
501         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_host.o $(BUILD_LIBS)
502
503 igen: igen.o table.o lf.o misc.o filter_host.o ld-decode.o ld-cache.o filter.o ld-insn.o gen-model.o gen-itable.o gen-icache.o gen-semantics.o gen-idecode.o gen-support.o
504         $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o igen igen.o table.o lf.o misc.o filter_host.o ld-decode.o ld-cache.o filter.o ld-insn.o gen-model.o gen-itable.o gen-icache.o gen-semantics.o gen-idecode.o gen-support.o $(BUILD_LIBS)
505
506 filter_host.c: filter_filename.c
507         cat $(srcdir)/filter_filename.c > filter_host.c
508
509 filter_host.o: filter_host.c filter_filename.h config.h ppc-config.h
510         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c filter_host.c
511
512 table.o: table.c misc.h filter_filename.h lf.h table.h
513         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/table.c
514
515 lf.o: lf.c misc.h filter_filename.h lf.h
516         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/lf.c
517
518 filter.o: filter.c misc.h lf.h table.h filter.h
519         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/filter.c
520 tmp-filter: filter.c misc.h misc.o
521         $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-filter -DMAIN $(srcdir)/filter.c misc.o $(BUILD_LIBS)
522
523 ld-decode.o: ld-decode.c misc.h lf.h table.h ld-decode.h
524         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-decode.c
525 tmp-ld-decode: ld-decode.o misc.o lf.o table.o filter_host.o 
526         $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-decode -DMAIN $(srcdir)/ld-decode.c misc.o lf.o table.o filter_host.o $(BUILD_LIBS)
527
528 ld-cache.o: ld-cache.c misc.h lf.h table.h ld-cache.h
529         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-cache.c
530 tmp-ld-cache: ld-cache.o misc.o lf.o table.o filter_host.o 
531         $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-cache -DMAIN $(srcdir)/ld-cache.c misc.o lf.o table.o filter_host.o $(BUILD_LIBS)
532
533 ld-insn.o: ld-insn.c misc.h lf.h table.h ld-insn.h ld-decode.h igen.h
534         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-insn.c
535 tmp-ld-insn: ld-insn.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o
536         $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-ld-insn -DMAIN $(srcdir)/ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o $(BUILD_LIBS)
537
538 gen-model.o: gen-model.c misc.h lf.h table.h gen-model.h ld-decode.h igen.h ld-insn.h ld-cache.h
539         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-model.c
540
541 gen-itable.o: gen-itable.c misc.h lf.h table.h gen-itable.h ld-decode.h igen.h ld-insn.h igen.h ld-cache.h
542         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-itable.c
543
544 gen-icache.o: gen-icache.c misc.h lf.h table.h gen-icache.h ld-decode.h igen.h ld-insn.h gen-semantics.h gen-idecode.h
545         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-icache.c
546
547 gen-semantics.o: gen-semantics.c misc.h lf.h table.h gen-semantics.h ld-decode.h igen.h ld-insn.h
548         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-semantics.c
549
550 gen-idecode.o: gen-idecode.c misc.h lf.h table.h gen-idecode.h gen-icache.h gen-semantics.h ld-decode.h igen.h ld-insn.h 
551         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-idecode.c
552
553 gen-support.o: gen-support.c misc.h lf.h table.h gen-support.h ld-decode.h igen.h ld-insn.h
554         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-support.c
555
556 dgen.o: dgen.c misc.h filter_filename.h lf.h table.h
557         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/dgen.c
558
559 igen.o: igen.c misc.h filter_filename.h lf.h table.h ld-decode.h ld-cache.h ld-insn.h filter.h gen-model.h gen-itable.h gen-icache.h gen-idecode.h gen-semantics.h gen-support.h igen.h 
560         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/igen.c
561
562 misc.o: misc.c misc.h filter_filename.h
563         $(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/misc.c
564
565
566
567 # real hardware
568 tmp-hw: Makefile $(HW_SRC) $(srcdir)/../../move-if-change
569         # The first for loop is to remove duplicates.
570         f=""; \
571         for i in $(HW_SRC) ; do \
572           case " $$f " in \
573             *" $$i "*) ;; \
574             *) f="$$f $$i" ;; \
575           esac ; \
576         done ; \
577         for hw in $$f ; do echo $$hw ; done \
578         | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
579                 -e 's/^/extern const device_descriptor /' \
580                 -e 's/$$/_device_descriptor\[\];/' \
581                 > tmp-hw.h
582         f=""; \
583         for i in $(HW_SRC) ; do \
584           case " $$f " in \
585             *" $$i "*) ;; \
586             *) f="$$f $$i" ;; \
587           esac ; \
588         done ; \
589         for hw in $$f ; do echo $$hw ; done \
590         | sed -e 's/^.*\(hw_.*\)\.c/\1/' \
591                 -e 's/^/    /' \
592                 -e 's/$$/_device_descriptor,/' \
593                 > tmp-hw.c
594         $(SHELL) $(srcdir)/../../move-if-change tmp-hw.h hw.h
595         $(SHELL) $(srcdir)/../../move-if-change tmp-hw.c hw.c
596         touch tmp-hw
597
598 hw_cpu.o: hw_cpu.c $(DEVICE_TABLE_H) $(CPU_H)
599 hw_core.o: hw_core.c $(DEVICE_TABLE_H)
600 hw_disk.o: hw_disk.c $(DEVICE_TABLE_H) pk.h
601 hw_glue.o: hw_glue.c $(DEVICE_TABLE_H)
602 hw_htab.o: hw_htab.c $(DEVICE_TABLE_H)
603 hw_ide.o: hw_ide.c $(DEVICE_TABLE_H)
604 hw_init.o: hw_init.c $(DEVICE_TABLE_H)
605 hw_iobus.o: hw_iobus.c $(DEVICE_TABLE_H)
606 hw_memory.o: hw_memory.c $(DEVICE_TABLE_H)
607 hw_nvram.o: hw_nvram.c $(DEVICE_TABLE_H)
608 hw_opic.o: hw_opic.c $(DEVICE_TABLE_H)
609 hw_pal.o: hw_pal.c $(DEVICE_TABLE_H) $(CPU_H)
610 hw_phb.o: hw_phb.c $(DEVICE_TABLE_H) hw_phb.h
611 hw_register.o: hw_register.c $(DEVICE_TABLE_H)
612 hw_trace.o: hw_trace.c $(DEVICE_TABLE_H)
613 hw_vm.o: hw_vm.c $(DEVICE_TABLE_H) $(CPU_H)
614 # ignore this line, it stops make from getting confused
615
616
617
618 # real packages
619 tmp-pk: Makefile $(PACKAGE_SRC) $(srcdir)/../../move-if-change
620         # The first for loop is to remove duplicates.
621         f=""; \
622         for i in $(PACKAGE_SRC) ; do \
623           case " $$f " in \
624             *" $$i "*) ;; \
625             *) f="$$f $$i" ;; \
626           esac ; \
627         done ; \
628         for pk in $$f ; do echo $$pk ; done \
629         | sed -e 's/^.*pk_\(.*\)\.c/\1/' \
630                 -e 's/^/extern package_create_instance_callback pk_/' \
631                 -e 's/$$/_create_instance;/' \
632                 > tmp-pk.h
633         $(SHELL) $(srcdir)/../../move-if-change tmp-pk.h pk.h
634         touch tmp-pk
635
636 pk_disklabel.o: pk.h $(DEVICE_TABLE_H)
637 # ignore this line, it stops make from getting confused
638
639
640
641 tags etags: TAGS
642
643 TAGS: $(BUILT_SRC)
644         etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
645
646 clean mostlyclean:
647         rm -f tmp-* *.[oasi] core psim$(EXEEXT) run$(EXEEXT) igen dgen $(BUILT_SRC_WO_CONFIG) gentmap
648
649 distclean realclean: clean
650         rm -f TAGS Makefile config.cache config.status config.h defines.h stamp-h config.log
651
652 maintainer-clean: distclean
653         rm -f *~ *.log ppc-config.h core *.core
654
655 Makefile: Makefile.in config.status
656         CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
657
658 config.h: stamp-h ; @true
659 stamp-h: config.in config.status
660         CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
661
662 config.status: configure
663         $(SHELL) ./config.status --recheck
664
665 install: installdirs
666         n=`echo run | sed '$(program_transform_name)'`; \
667         $(INSTALL_PROGRAM) run$(EXEEXT) $(bindir)/$$n$(EXEEXT)
668
669 installdirs:
670         $(SHELL) $(srcdir)/../../mkinstalldirs $(bindir)