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