xref: /netbsd-src/external/gpl3/gdb.old/dist/sim/ppc/Makefile.in (revision fdd524d4ccd2bb0c6f67401e938dabf773eb0372)
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 3 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, see <http://www.gnu.org/licenses/>.
18#
19
20default: all
21
22VPATH = @srcdir@
23srcdir = @srcdir@
24srccom = $(srcdir)/../common
25srcroot = $(srcdir)/../..
26srcsim = $(srcdir)/..
27
28prefix = @prefix@
29exec_prefix = @exec_prefix@
30
31host_alias = @host_alias@
32target_alias = @target_alias@
33program_transform_name = @program_transform_name@
34bindir = @bindir@
35libdir = @libdir@
36tooldir = $(libdir)/$(target_alias)
37
38datarootdir = @datarootdir@
39datadir = @datadir@
40mandir = @mandir@
41man1dir = $(mandir)/man1
42man2dir = $(mandir)/man2
43man3dir = $(mandir)/man3
44man4dir = $(mandir)/man4
45man5dir = $(mandir)/man5
46man6dir = $(mandir)/man6
47man7dir = $(mandir)/man7
48man8dir = $(mandir)/man8
49man9dir = $(mandir)/man9
50infodir = @infodir@
51includedir = @includedir@
52
53# This can be referenced by the gettext configuration code.
54top_builddir = ..
55
56EXEEXT = @EXEEXT@
57SHELL = /bin/sh
58
59INSTALL = @INSTALL@
60INSTALL_PROGRAM = @INSTALL_PROGRAM@
61INSTALL_DATA = @INSTALL_DATA@
62
63AR = @AR@
64AR_FLAGS = rc
65CC = @CC@
66CFLAGS = @CFLAGS@
67CC_FOR_BUILD = @CC_FOR_BUILD@
68CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
69BISON = bison
70MAKEINFO = makeinfo
71RANLIB = @RANLIB@
72
73SIM_CFLAGS = @sim_cflags@
74INLINE_CFLAGS = @sim_inline@
75BSWAP_CFLAGS = @sim_bswap@
76ENDIAN_CFLAGS = @sim_endian@
77REGPARM_CFLAGS = @sim_regparm@
78STDCALL_CFLAGS = @sim_stdcall@
79HOSTENDIAN_CFLAGS = @sim_hostendian@
80SMP_CFLAGS = @sim_smp@
81XOR_ENDIAN_CFLAGS = @sim_xor_endian@
82BITSIZE_CFLAGS = @sim_bitsize@
83HOSTBITSIZE_CFLAGS = @sim_hostbitsize@
84ENV_CFLAGS = @sim_env@
85TIMEBASE_CFLAGS = @sim_timebase@
86ALIGNMENT_CFLAGS = @sim_alignment@
87FLOAT_CFLAGS = @sim_float@
88TRACE_CFLAGS = @sim_trace@
89ASSERT_CFLAGS = @sim_assert@
90RESERVED_CFLAGS = @sim_reserved@
91MONITOR_CFLAGS = @sim_monitor@
92MODEL_CFLAGS = @sim_model@ @sim_default_model@ @sim_model_issue@
93STDIO_CFLAGS = @sim_stdio@
94TERMIO_CFLAGS = @sim_termio@
95WARNING_CFLAGS = @sim_warnings@
96DEVZERO_CFLAGS = @sim_devzero@
97CONFIG_CFLAGS = $(BSWAP_CFLAGS) \
98  $(ENDIAN_CFLAGS) \
99  $(REGPARM_CFLAGS) \
100  $(STDCALL_CFLAGS) \
101  $(HOSTENDIAN_CFLAGS) \
102  $(SMP_CFLAGS) \
103  $(XOR_ENDIAN_CFLAGS) \
104  $(BITSIZE_CFLAGS) \
105  $(HOSTBITSIZE_CFLAGS) \
106  $(ENV_CFLAGS) \
107  $(TIMEBASE_CFLAGS) \
108  $(ALIGNMENT_CFLAGS) \
109  $(FLOAT_CFLAGS) \
110  $(TRACE_CFLAGS) \
111  $(ASSERT_CFLAGS) \
112  $(RESERVED_CFLAGS) \
113  $(MONITOR_CFLAGS) \
114  $(MODEL_CFLAGS) \
115  $(STDIO_CFLAGS) \
116  $(TERMIO_CFLAGS) \
117  $(DEVZERO_CFLAGS)
118SIM_FPU_CFLAGS = @sim_fpu_cflags@
119
120STD_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(WARNING_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES) $(INTL_CFLAGS) $(SIM_FPU_CFLAGS)
121NOWARN_CFLAGS	= $(CFLAGS) $(INLINE_CFLAGS) $(CONFIG_CFLAGS) $(SIM_CFLAGS) $(HDEFINES) $(TDEFINES) $(INCLUDES)  $(SIM_FPU_CFLAGS)
122BUILD_CFLAGS	= $(CFLAGS_FOR_BUILD) $(INCLUDES) $(WARNING_CFLAGS)
123
124BUILD_LDFLAGS	=
125LIBS = @LIBS@
126
127CONFIG_FILE = @sim_config@
128IGEN_OPCODE_RULES = @sim_opcode@
129IGEN_DECODE_MECHANISM = @sim_decode_mechanism@
130IGEN_DUPLICATE = @sim_dup@
131IGEN_JUMP = @sim_jump@
132IGEN_FILTER = @sim_filter@
133IGEN_ICACHE = @sim_icache@
134IGEN_SMP = @sim_igen_smp@
135IGEN_LINE_NR = @sim_line_nr@
136DGEN_FLAGS = @sim_switch@
137
138HDEFINES = @HDEFINES@
139TDEFINES =
140IGEN_FLAGS = \
141	$(IGEN_DECODE_MECHANISM) \
142	$(IGEN_DUPLICATE) \
143	$(IGEN_JUMP) \
144	$(IGEN_FILTER) \
145	$(IGEN_ICACHE) \
146	$(IGEN_SMP) \
147	$(IGEN_LINE_NR)
148
149.NOEXPORT:
150MAKEOVERRIDES=
151
152LIB_INCLUDES	= -I$(srcdir)/../../include
153BFD_INCLUDES	= -I../../bfd -I$(srcdir)/../../bfd
154GDB_INCLUDES	= -I../../gdb -I$(srcdir)/../../gdb  -I$(srcdir)/../../gdb/config
155
156INCLUDES	= -I. -I$(srcdir) $(LIB_INCLUDES) $(BFD_INCLUDES) $(GDB_INCLUDES)
157
158LIBIBERTY_LIB	= ../../libiberty/libiberty.a
159BFD_LIB		= ../../bfd/libbfd.a
160
161LIBINTL = @LIBINTL@
162LIBINTL_DEP = @LIBINTL_DEP@
163INTL_CFLAGS = @INCINTL@
164
165
166TARGETLIB	= libsim.a
167
168all:	run $(TARGETLIB) $(GDB_OBJ)
169
170.c.o:
171	$(CC) -c $(STD_CFLAGS) $<
172
173
174# Headers outside sim/ppc.
175ANSIDECL_H = $(srcroot)/include/ansidecl.h
176BFD_H = ../../bfd/bfd.h
177GDB_CALLBACK_H = $(srcroot)/include/gdb/callback.h
178GDB_REMOTE_SIM_H = $(srcroot)/include/gdb/remote-sim.h
179GDB_SIM_PPC_H = $(srcroot)/include/gdb/sim-ppc.h
180COMMON_SIM_BASE_H = $(srcroot)/sim/common/sim-base.h
181COMMON_SIM_BASICS_H = $(srcroot)/sim/common/sim-basics.h
182COMMON_SIM_FPU_H = $(srcroot)/sim/common/sim-fpu.h
183COMMON_SIM_INLINE_H = $(srcroot)/sim/common/sim-inline.h
184COMMON_SIM_SIGNAL_H = $(srcroot)/sim/common/sim-signal.h
185
186# Headers in sim/ppc.
187ACCONFIG_H = \
188	acconfig.h
189
190ALTIVEC_EXPRESSION_H = \
191	altivec_expression.h
192
193ALTIVEC_REGISTERS_H = \
194	altivec_registers.h
195
196BASICS_H = \
197	basics.h \
198	$(CONFIG_H) \
199	$(PPC_CONFIG_H) \
200	$(INLINE_H) \
201	$(SIM_CALLBACKS_H) \
202	$(DEBUG_H) \
203	$(WORDS_H) \
204	$(BITS_H) \
205	$(SIM_ENDIAN_H)
206
207BITS_H = \
208	bits.h \
209	bits.c
210
211CAP_H = \
212	cap.h \
213	$(BASICS_H)
214
215COREFILE_H = \
216	corefile.h
217
218COREFILE_N_H = \
219	corefile-n.h
220
221CPU_H = \
222	cpu.h \
223	$(BASICS_H) \
224	$(REGISTERS_H) \
225	$(DEVICE_H) \
226	$(COREFILE_H) \
227	$(VM_H) \
228	$(EVENTS_H) \
229	$(INTERRUPTS_H) \
230	$(PSIM_H) \
231	$(IDECODE_H) \
232	$(ITABLE_H) \
233	$(OS_EMUL_H) \
234	$(MON_H) \
235	$(MODEL_H) \
236	cpu.c
237
238DEBUG_H = \
239	debug.h \
240	$(FILTER_FILENAME_H)
241
242DEVICE_H = \
243	device.h
244
245DEVICE_TABLE_H = \
246	device_table.h \
247	$(BASICS_H) \
248	$(DEVICE_H) \
249	$(TREE_H) \
250	$(HW_H)
251
252E500_EXPRESSION_H = \
253	e500_expression.h
254
255E500_REGISTERS_H = \
256	e500_registers.h
257
258EMUL_BUGAPI_H = \
259	emul_bugapi.h
260
261EMUL_CHIRP_H = \
262	emul_chirp.h
263
264EMUL_GENERIC_H = \
265	emul_generic.h \
266	$(CPU_H) \
267	$(IDECODE_H) \
268	$(OS_EMUL_H) \
269	$(TREE_H) \
270	$(BFD_H)
271
272EMUL_NETBSD_H = \
273	emul_netbsd.h
274
275EMUL_UNIX_H = \
276	emul_unix.h
277
278EVENTS_H = \
279	events.h
280
281FILTER_FILENAME_H = \
282	filter_filename.h
283
284FILTER_H = \
285	filter.h
286
287GEN_ICACHE_H = \
288	gen-icache.h
289
290GEN_IDECODE_H = \
291	gen-idecode.h
292
293GEN_ITABLE_H = \
294	gen-itable.h
295
296GEN_MODEL_H = \
297	gen-model.h
298
299GEN_SEMANTICS_H = \
300	gen-semantics.h
301
302GEN_SUPPORT_H = \
303	gen-support.h
304
305HW_CPU_H = \
306	hw_cpu.h
307
308HW_PHB_H = \
309	hw_phb.h
310
311IDECODE_BRANCH_H = \
312	idecode_branch.h
313
314IDECODE_EXPRESSION_H = \
315	idecode_expression.h \
316	$(ALTIVEC_EXPRESSION_H) \
317	$(E500_EXPRESSION_H)
318
319IDECODE_FIELDS_H = \
320	idecode_fields.h
321
322IGEN_H = \
323	igen.h
324
325INLINE_H = \
326	inline.h
327
328INTERRUPTS_H = \
329	interrupts.h
330
331LD_CACHE_H = \
332	ld-cache.h
333
334LD_DECODE_H = \
335	ld-decode.h
336
337LD_INSN_H = \
338	ld-insn.h
339
340LF_H = \
341	lf.h
342
343MISC_H = \
344	misc.h \
345	$(CONFIG_H) \
346	$(FILTER_FILENAME_H)
347
348MON_H = \
349	mon.h \
350	$(BASICS_H) \
351	$(ITABLE_H)
352
353OPTIONS_H = \
354	options.h
355
356OS_EMUL_H = \
357	os_emul.h
358
359PSIM_H = \
360	psim.h \
361	$(BASICS_H)
362
363REGISTERS_H = \
364	registers.h \
365	$(E500_REGISTERS_H) \
366	$(ALTIVEC_REGISTERS_H) \
367	$(SPREG_H)
368
369SIM_CALLBACKS_H = \
370	sim_callbacks.h
371
372SIM_ENDIAN_H = \
373	sim-endian.h \
374	sim-endian.c
375
376SIM_ENDIAN_N_H = \
377	sim-endian-n.h
378
379SIM_MAIN_H = \
380	sim-main.h \
381	$(COMMON_SIM_BASICS_H) \
382	$(COMMON_SIM_SIGNAL_H) \
383	$(COMMON_SIM_BASE_H)
384
385STD_CONFIG_H = \
386	std-config.h
387
388TABLE_H = \
389	table.h
390
391TREE_H = \
392	tree.h
393
394VM_H = \
395	vm.h
396
397VM_N_H = \
398	vm_n.h
399
400WORDS_H = \
401	words.h
402
403
404# Generated headers.
405CONFIG_H = \
406        config.h
407
408DEFINES_H = \
409        defines.h
410
411HW_H = \
412        hw.h
413
414ICACHE_H = \
415        icache.h
416
417IDECODE_H = \
418        idecode.h \
419        $(IDECODE_EXPRESSION_H) \
420        $(IDECODE_FIELDS_H) \
421        $(IDECODE_BRANCH_H)
422
423ITABLE_H = \
424        itable.h
425
426MODEL_H = \
427        model.h
428
429PK_H = \
430        pk.h
431
432PPC_CONFIG_H = \
433        ppc-config.h
434
435SEMANTICS_H = \
436        semantics.h
437
438SPREG_H = \
439        spreg.h
440
441SUPPORT_H = \
442        support.h \
443        support.c
444
445TARG_VALS_H = \
446        targ-vals.h
447
448TCONFIG_H = \
449        tconfig.h
450
451INLINE = \
452	inline.h \
453	inline.c
454
455BUILT_SRC_WO_CONFIG = \
456	icache.h icache.c \
457	support.h support.c \
458	idecode.h idecode.c \
459	semantics.h semantics.c \
460	itable.h itable.c \
461	spreg.h spreg.c \
462	model.h model.c \
463	support.h support.c \
464	pk.h \
465	hw.h hw.c \
466	filter_host.c \
467	@sim_targ_vals@
468
469BUILT_SRC = \
470	$(BUILT_SRC_WO_CONFIG) \
471	config.h \
472	ppc-config.h
473
474LIB_INLINE_SRC = \
475	psim.c \
476	bits.c \
477	debug.c \
478	sim-endian.c \
479	sim-endian.h \
480	sim-endian-n.h \
481	vm.c \
482	vm_n.h \
483	corefile.c \
484	events.c \
485	os_emul.c \
486	registers.c \
487	cpu.c \
488	interrupts.c \
489	device.c \
490	tree.c \
491	device_table.c \
492	cap.c \
493	mon.c \
494	options.c
495
496LIB_SRC = \
497	$(PACKAGE_SRC) \
498	$(HW_SRC) \
499	$(LIB_INLINE_SRC)
500
501MAIN_SRC = \
502	main.c \
503	gdb-sim.c \
504	sim_calls.c
505
506
507# NOTE: semantics, idecode and psim put last so smaller files are compiled
508#       first
509LIB_OBJ = \
510	debug.o \
511	filter_filename.o \
512	bits.o \
513	sim-endian.o \
514	os_emul.o \
515	emul_generic.o \
516	emul_bugapi.o \
517	emul_chirp.o \
518	emul_netbsd.o \
519	emul_unix.o \
520	registers.o \
521	vm.o \
522	corefile.o \
523	model.o \
524	spreg.o \
525	cpu.o \
526	interrupts.o \
527	events.o \
528	cap.o \
529	device.o \
530	tree.o \
531	device_table.o \
532	itable.o \
533	mon.o \
534	icache.o \
535	semantics.o \
536	idecode.o \
537	support.o \
538	@sim_fpu@ \
539	psim.o \
540	version.o \
541	$(PACKAGE_OBJ) \
542	$(HW_OBJ) \
543	options.o
544
545
546GDB_OBJ = gdb-sim.o sim_calls.o @sim_callback@
547
548HW_SRC = @sim_hw_src@
549HW_OBJ = @sim_hw_obj@
550
551PACKAGE_SRC = @sim_pk_src@
552PACKAGE_OBJ = @sim_pk_obj@
553
554
555psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBINTL_DEP)
556	$(CC) $(CFLAGS) $(SIM_CFLAGS) $(LDFLAGS) -o psim$(EXEEXT) main.o $(TARGETLIB) $(BFD_LIB) $(LIBINTL) $(LIBIBERTY_LIB) $(LIBS)
557
558run: psim
559	rm -f run$(EXEEXT)
560	ln psim$(EXEEXT) run$(EXEEXT)
561
562$(TARGETLIB): tmp-igen tmp-dgen tmp-hw tmp-pk tmp-defines $(LIB_OBJ) $(GDB_OBJ)
563	rm -f $(TARGETLIB)
564	$(AR) $(AR_FLAGS) $(TARGETLIB) $(LIB_OBJ) $(GDB_OBJ)
565	$(RANLIB) $(TARGETLIB)
566
567version.c: Makefile $(srccom)/create-version.sh ../../bfd/version.h ../../gdb/version.in
568	$(SHELL) $(srccom)/create-version.sh $(srcsim) $(host_alias) $(target_alias) version.c
569version.o: version.c $(version_h)
570
571psim.o: psim.c $(CPU_H) $(IDECODE_H) $(OPTIONS_H) $(TREE_H) $(BFD_H)
572
573bits.o: bits.c $(BASICS_H)
574
575debug.o: debug.c $(CONFIG_H) $(BASICS_H)
576filter_filename.o: filter_filename.c $(CONFIG_H) $(PPC_CONFIG_H) $(FILTER_FILENAME_H)
577
578sim-endian.o: sim-endian.c $(CONFIG_H) $(BASICS_H) $(SIM_ENDIAN_N_H)
579
580os_emul.o: os_emul.c $(CPU_H) $(IDECODE_H) $(OS_EMUL_H) $(EMUL_GENERIC_H) $(EMUL_NETBSD_H) $(EMUL_UNIX_H) $(EMUL_CHIRP_H) $(EMUL_BUGAPI_H)
581emul_generic.o: emul_generic.c $(EMUL_GENERIC_H)
582
583emul_bugapi.o: emul_bugapi.c $(EMUL_GENERIC_H) $(EMUL_BUGAPI_H)
584emul_chirp.o: emul_chirp.c $(EMUL_GENERIC_H) $(EMUL_CHIRP_H)
585emul_netbsd.o: emul_netbsd.c $(EMUL_GENERIC_H) $(EMUL_NETBSD_H)
586emul_unix.o: emul_unix.c $(EMUL_GENERIC_H) $(EMUL_UNIX_H)
587
588registers.o: registers.c $(BASICS_H) $(REGISTERS_H)
589
590cpu.o: cpu.c $(CPU_H) $(IDECODE_H)
591
592interrupts.o: interrupts.c $(CPU_H) $(IDECODE_H) $(OS_EMUL_H)
593
594# Given that inlines are turned on now, rebuild idecode whenever
595# anything changes.
596idecode.o: idecode.c $(CPU_H) $(IDECODE_H) $(SEMANTICS_H) $(LIB_INLINE_SRC) $(BUILT_SRC)
597
598# double.o: double.c dp-bit.c
599
600vm.o: vm.c $(BASICS_H) $(REGISTERS_H) $(DEVICE_H) $(COREFILE_H) $(VM_H) $(INTERRUPTS_H) $(MON_H) $(CPU_H) $(VM_N_H)
601
602corefile.o: corefile.c $(BASICS_H) $(DEVICE_TABLE_H) $(COREFILE_H) $(COREFILE_N_H)
603
604model.o: model.c $(CPU_H) $(MON_H)
605
606events.o: events.c $(BASICS_H) $(EVENTS_H)
607
608sim_calls.o: sim_calls.c $(PSIM_H) $(OPTIONS_H) $(DEFS_H) $(BFD_H) $(GDB_CALLBACK_H) $(GDB_REMOTE_SIM_H)
609
610gdb-sim.o: gdb-sim.c $(PSIM_H)  $(OPTIONS_H) $(REGISTERS_H) $(GDB_REMOTE_SIM_H) $(GDB_SIM_PPC_H) $(SIM_CALLBACK_H)
611
612spreg.o: spreg.c $(BASICS_H) $(SPREG_H)
613
614main.o: main.c $(PSIM_H) $(OPTIONS_H) $(DEVICE_H) $(EVENTS_H) $(BFD_H) $(GDB_CALLBACK_H) $(GDB_REMOTE_SIM_H)
615
616device.o: device.c $(DEVICE_TABLE_H) $(CAP_H) $(EVENTS_H) $(PSIM_H)
617
618tree.o: tree.c $(BASICS_H) $(DEVICE_H) $(TREE_H)
619
620device_table.o: device_table.c $(DEVICE_TABLE_H) hw.c
621
622cap.o: cap.c $(CAP_H)
623
624semantics.o: semantics.c $(CPU_H) $(IDECODE_H) $(SEMANTICS_H) $(COMMON_SIM_INLINE_H) $(COMMON_SIM_FPU_H) $(SUPPORT_H)
625
626icache.o: icache.c $(CPU_H) $(IDECODE_H) $(SEMANTICS_H) $(ICACHE_H) $(COMMON_SIM_INLINE_H) $(COMMON_SIM_FPU_H) $(SUPPORT_H)
627
628support.o: support.c $(CPU_H) $(IDECODE_H) $(COMMON_SIM_INLINE_H) $(COMMON_SIM_FPU_H) $(SUPPORT_H)
629
630itable.o: itable.c $(ITABLE_H)
631
632mon.o: mon.c $(BASICS_H) $(CPU_H) $(MON_H)
633
634# GDB after 4.16 expects the default_callback structure to be setup.
635# As a kludge, build the common stuff here for now.
636gentmap: ../common/gentmap.c Makefile targ-vals.def
637	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -I. -I../common -I$(srcdir)/../common -o gentmap $< $(BUILD_LIBS)
638
639targ-vals.def: $(srcdir)/../common/nltvals.def
640	rm -f targ-vals.def tmp-def
641	cat $(srcdir)/../common/nltvals.def > tmp-vals.def
642	$(SHELL) $(srcdir)/../../move-if-change tmp-vals.def targ-vals.def
643
644targ-vals.h: Makefile gentmap $(srcdir)/../../move-if-change
645	rm -f tmp-vals.h
646	./gentmap -h > tmp-vals.h
647	$(SHELL) $(srcdir)/../../move-if-change tmp-vals.h targ-vals.h
648
649targ-map.c: Makefile gentmap $(srcdir)/../../move-if-change
650	rm -f tmp-map.c
651	./gentmap -c > tmp-map.c
652	$(SHELL) $(srcdir)/../../move-if-change tmp-map.c targ-map.c
653
654callback.o: ../common/callback.c $(TARG_VALS_H) $(CONFIG_H)
655	$(CC) -c $(STD_CFLAGS) -DHAVE_CONFIG_H $<
656
657targ-map.o: targ-map.c $(ANSIDECL_H) $(GDB_CALLBACK_H) $(TARG_VALS_H)
658
659sim-fpu.o: $(srcdir)/../common/sim-fpu.c $(CONFIG_H) $(TCONFIG_H)
660	$(CC) -c $(STD_CFLAGS) -DHAVE_CONFIG_H $(srcdir)/../common/sim-fpu.c
661
662tconfig.h:
663	rm -f tconfig.h
664	echo > tconfig.h
665
666# Rebuild options whenever something changes so the date/time is up to date.
667options.o: options.c $(CPU_H) $(OPTIONS_H) $(DEFINES_H) $(BASICS_H) $(IDECODE_H) $(INLINE) $(LIB_SRC) $(BUILT_SRC) config.status Makefile
668	$(CC) -c $(STD_CFLAGS) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $<
669
670defines.h: tmp-defines; @true
671tmp-defines: config.h Makefile
672	sed -n -e '/^#define HAVE_/s/ 1$$/",/' -e '/^#define HAVE_/s//"HAVE_/p' < config.h > tmp-defines.h
673	$(SHELL) $(srcdir)/../../move-if-change tmp-defines.h defines.h
674	touch tmp-defines
675
676#
677# Rules to create the built c source code files
678#
679
680ppc-config.h: $(CONFIG_FILE)
681	cp $(srcdir)/$(CONFIG_FILE) ppc-config.h
682
683
684tmp-dgen: dgen ppc-spr-table $(srcdir)/../../move-if-change
685	./dgen $(DGEN_FLAGS) \
686		-r $(srcdir)/ppc-spr-table \
687		-n spreg.h -hp tmp-spreg.h \
688		-n spreg.c -p  tmp-spreg.c
689	$(SHELL) $(srcdir)/../../move-if-change tmp-spreg.h spreg.h
690	$(SHELL) $(srcdir)/../../move-if-change tmp-spreg.c spreg.c
691	touch tmp-dgen
692
693tmp-igen: igen $(srcdir)/ppc-instructions $(srcdir)/altivec.igen $(srcdir)/e500.igen $(IGEN_OPCODE_RULES) $(srcdir)/../../move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
694	./igen	$(IGEN_FLAGS) \
695		-o $(srcdir)/$(IGEN_OPCODE_RULES) \
696		-I $(srcdir) -i $(srcdir)/ppc-instructions \
697		-n icache.h    -hc tmp-icache.h \
698		-n icache.c    -c  tmp-icache.c \
699		-n semantics.h -hs tmp-semantics.h \
700		-n semantics.c -s  tmp-semantics.c \
701		-n idecode.h   -hd tmp-idecode.h \
702		-n idecode.c   -d  tmp-idecode.c \
703		-n itable.h    -ht tmp-itable.h \
704		-n itable.c    -t  tmp-itable.c \
705		-n model.h     -hm tmp-model.h \
706		-n model.c     -m  tmp-model.c \
707		-n support.h   -hf tmp-support.h \
708		-n support.c   -f  tmp-support.c
709	$(SHELL) $(srcdir)/../../move-if-change tmp-icache.h icache.h
710	$(SHELL) $(srcdir)/../../move-if-change tmp-icache.c icache.c
711	$(SHELL) $(srcdir)/../../move-if-change tmp-idecode.h idecode.h
712	$(SHELL) $(srcdir)/../../move-if-change tmp-idecode.c idecode.c
713	$(SHELL) $(srcdir)/../../move-if-change tmp-semantics.h semantics.h
714	$(SHELL) $(srcdir)/../../move-if-change tmp-semantics.c semantics.c
715	$(SHELL) $(srcdir)/../../move-if-change tmp-itable.h itable.h
716	$(SHELL) $(srcdir)/../../move-if-change tmp-itable.c itable.c
717	$(SHELL) $(srcdir)/../../move-if-change tmp-model.h model.h
718	$(SHELL) $(srcdir)/../../move-if-change tmp-model.c model.c
719	$(SHELL) $(srcdir)/../../move-if-change tmp-support.h support.h
720	$(SHELL) $(srcdir)/../../move-if-change tmp-support.c support.c
721	touch tmp-igen
722
723# NOTE: Some versions of make don't handle files created as side-effects
724# uncomment the below if that is the case.
725
726$(TARGETLIB): tmp-igen tmp-dgen
727itable.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
728spreg.h spreg.c: tmp-dgen
729
730dgen: dgen.o table.o lf.o misc.o filter_host.o
731	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -o dgen dgen.o table.o lf.o misc.o filter_host.o $(BUILD_LIBS)
732
733igen: 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
734	$(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)
735
736filter_host.c: filter_filename.c
737	cat $(srcdir)/filter_filename.c > filter_host.c
738
739filter_host.o: filter_host.c $(CONFIG_H) $(PPC_CONFIG_H) $(FILTER_FILENAME_H)
740	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c filter_host.c
741
742table.o: table.c $(CONFIG_H) $(MISC_H) $(LF_H) $(TABLE_H)
743	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/table.c
744
745lf.o: lf.c $(CONFIG_H) $(MISC_H) $(LF_H)
746	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/lf.c
747
748filter.o: filter.c $(CONFIG_H) $(MISC_H) $(FILTER_H)
749	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/filter.c
750tmp-filter: filter.c $(MISC_H) misc.o
751	$(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o tmp-filter -DMAIN $(srcdir)/filter.c misc.o $(BUILD_LIBS)
752
753ld-decode.o: ld-decode.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_DECODE_H)
754	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-decode.c
755tmp-ld-decode: ld-decode.c misc.o lf.o table.o filter_host.o
756	$(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)
757
758ld-cache.o: ld-cache.c $(MISC_H) $(LF_H) $(TABLE_H) $(LD_CACHE_H)
759	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-cache.c
760tmp-ld-cache: ld-cache.c misc.o lf.o table.o filter_host.o
761	$(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)
762
763ld-insn.o: ld-insn.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H)
764	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/ld-insn.c
765tmp-ld-insn: ld-insn.c ld-cache.o misc.o lf.o table.o ld-decode.o filter_host.o filter.o
766	$(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)
767
768gen-model.o: gen-model.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(GEN_MODEL_H)
769	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-model.c
770
771gen-itable.o: gen-itable.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_ITABLE_H)
772	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-itable.c
773
774gen-icache.o: gen-icache.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_IDECODE_H) $(GEN_ICACHE_H)
775	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-icache.c
776
777gen-semantics.o: gen-semantics.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_ICACHE_H) $(GEN_IDECODE_H)
778	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-semantics.c
779
780gen-idecode.o: gen-idecode.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_IDECODE_H) $(GEN_ICACHE_H) $(GEN_SEMANTICS_H)
781	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-idecode.c
782
783gen-support.o: gen-support.c $(MISC_H) $(LF_H) $(TABLE_H) $(FILTER_H) $(LD_DECODE_H) $(LD_CACHE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_SEMANTICS_H) $(GEN_SUPPORT_H)
784	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gen-support.c
785
786dgen.o: dgen.c $(CONFIG_H) $(MISC_H) $(LF_H) $(TABLE_H)
787	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/dgen.c
788
789igen.o: igen.c $(MISC_H) $(LF_H) $(TABLE_H) $(CONFIG_H) $(FILTER_H) $(LD_CACHE_H) $(LD_DECODE_H) $(LD_INSN_H) $(IGEN_H) $(GEN_MODEL_H) $(GEN_ICACHE_H) $(GEN_ITABLE_H) $(GEN_IDECODE_H) $(GEN_SEMANTICS_H) $(GEN_SUPPORT_H)
790	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/igen.c
791
792misc.o: misc.c $(CONFIG_H) $(MISC_H)
793	$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/misc.c
794
795
796
797# real hardware
798hw.c hw.h: tmp-hw; @true
799tmp-hw: Makefile $(HW_SRC) $(srcdir)/../../move-if-change
800	# The first for loop is to remove duplicates.
801	f=""; \
802	for i in $(HW_SRC) ; do \
803	  case " $$f " in \
804	    *" $$i "*) ;; \
805	    *) f="$$f $$i" ;; \
806	  esac ; \
807	done ; \
808	for hw in $$f ; do echo $$hw ; done \
809	| sed -e 's/^.*\(hw_.*\)\.c/\1/' \
810		-e 's/^/extern const device_descriptor /' \
811		-e 's/$$/_device_descriptor\[\];/' \
812		> tmp-hw.h
813	f=""; \
814	for i in $(HW_SRC) ; do \
815	  case " $$f " in \
816	    *" $$i "*) ;; \
817	    *) f="$$f $$i" ;; \
818	  esac ; \
819	done ; \
820	for hw in $$f ; do echo $$hw ; done \
821	| sed -e 's/^.*\(hw_.*\)\.c/\1/' \
822		-e 's/^/    /' \
823		-e 's/$$/_device_descriptor,/' \
824		> tmp-hw.c
825	$(SHELL) $(srcdir)/../../move-if-change tmp-hw.h hw.h
826	$(SHELL) $(srcdir)/../../move-if-change tmp-hw.c hw.c
827	touch tmp-hw
828
829hw_cpu.o: hw_cpu.c $(DEVICE_TABLE_H) $(HW_CPU_H) $(INTERRUPTS_H) $(CPU_H)
830hw_com.o: hw_com.c $(DEVICE_TABLE_H)
831hw_core.o: hw_core.c $(DEVICE_TABLE_H) $(COREFILE_H)
832hw_disk.o: hw_disk.c $(DEVICE_TABLE_H) $(PK_H)
833hw_eeprom.o: hw_eeprom.c $(DEVICE_TABLE_H)
834hw_glue.o: hw_glue.c $(DEVICE_TABLE_H)
835hw_htab.o: hw_htab.c $(DEVICE_TABLE_H) $(BFD_H)
836hw_ide.o: hw_ide.c $(DEVICE_TABLE_H)
837hw_init.o: hw_init.c $(DEVICE_TABLE_H) $(BFD_H) $(PSIM_H)
838hw_iobus.o: hw_iobus.c $(DEVICE_TABLE_H)
839hw_memory.o: hw_memory.c $(DEVICE_TABLE_H)
840hw_nvram.o: hw_nvram.c $(DEVICE_TABLE_H)
841hw_opic.o: hw_opic.c $(DEVICE_TABLE_H)
842hw_pal.o: hw_pal.c $(DEVICE_TABLE_H) $(CPU_H)
843hw_phb.o: hw_phb.c $(DEVICE_TABLE_H) $(HW_PHB_H) $(COREFILE_H)
844hw_register.o: hw_register.c $(DEVICE_TABLE_H) $(PSIM_H)
845hw_sem.o: hw_sem.c $(DEVICE_TABLE_H) $(PSIM_H)
846hw_shm.o: hw_shm.c $(DEVICE_TABLE_H) $(PSIM_H)
847hw_trace.o: hw_trace.c $(DEVICE_TABLE_H)
848hw_vm.o: hw_vm.c $(DEVICE_TABLE_H) $(CPU_H)
849# ignore this line, it stops make from getting confused
850
851
852
853# real packages
854pk.h: tmp-pk; @true
855tmp-pk: Makefile $(PACKAGE_SRC) $(srcdir)/../../move-if-change
856	# The first for loop is to remove duplicates.
857	f=""; \
858	for i in $(PACKAGE_SRC) ; do \
859	  case " $$f " in \
860	    *" $$i "*) ;; \
861	    *) f="$$f $$i" ;; \
862	  esac ; \
863	done ; \
864	for pk in $$f ; do echo $$pk ; done \
865	| sed -e 's/^.*pk_\(.*\)\.c/\1/' \
866		-e 's/^/extern package_create_instance_callback pk_/' \
867		-e 's/$$/_create_instance;/' \
868		> tmp-pk.h
869	$(SHELL) $(srcdir)/../../move-if-change tmp-pk.h pk.h
870	touch tmp-pk
871
872pk_disklabel.o: pk_disklabel.c $(DEVICE_TABLE_H) $(PK_H)
873# ignore this line, it stops make from getting confused
874
875
876
877tags etags: TAGS
878
879TAGS: $(BUILT_SRC)
880	etags $(srcdir)/*.h $(srcdir)/*.c $(BUILT_SRC)
881
882clean mostlyclean:
883	rm -f tmp-* *.[oasi] core psim$(EXEEXT) run$(EXEEXT) igen dgen $(BUILT_SRC_WO_CONFIG) gentmap
884
885distclean realclean: clean
886	rm -f TAGS Makefile config.cache config.status config.h defines.h stamp-h config.log
887
888maintainer-clean: distclean
889	rm -f *~ *.log ppc-config.h core *.core
890
891Makefile: Makefile.in config.status
892	CONFIG_FILES=Makefile CONFIG_HEADERS= $(SHELL) ./config.status
893
894config.h: stamp-h ; @true
895stamp-h: config.in config.status
896	CONFIG_FILES= CONFIG_HEADERS=config.h:config.in $(SHELL) ./config.status
897
898config.status: configure
899	$(SHELL) ./config.status --recheck
900
901install: installdirs
902	n=`echo run | sed '$(program_transform_name)'`; \
903	$(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
904
905installdirs:
906	$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)
907