2 # This file is part of the program psim.
4 # Copyright (C) 1994-1996, Andrew Cagney <cagney@highland.com.au>
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.
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.
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.
25 srcroot
= $(srcdir)/..
/..
28 exec_prefix = @
exec_prefix@
30 host_alias
= @host_alias@
31 target_alias
= @target_alias@
32 program_transform_name
= @program_transform_name@
35 tooldir
= $(libdir)/$(target_alias
)
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
49 includedir = @
includedir@
53 INSTALL
= $(srcroot
)/install.sh
-c
54 INSTALL_PROGRAM
= @INSTALL_PROGRAM@
55 INSTALL_DATA
= @INSTALL_DATA@
56 INSTALL_XFORM
= $(INSTALL
) -t
='$(program_transform_name)'
57 INSTALL_XFORM1
= $(INSTALL_XFORM
) -b
=.1
63 CC_FOR_BUILD
= @CC_FOR_BUILD@
68 SIM_CFLAGS
= @sim_cflags@
69 INLINE_CFLAGS
= @sim_inline@
70 BSWAP_CFLAGS
= @sim_bswap@
71 ENDIAN_CFLAGS
= @sim_endian@
72 HOSTENDIAN_CFLAGS
= @sim_hostendian@
73 SMP_CFLAGS
= @sim_smp@
74 XOR_ENDIAN_CFLAGS
= @sim_xor_endian@
75 BITSIZE_CFLAGS
= @sim_bitsize@
76 HOSTBITSIZE_CFLAGS
= @sim_hostbitsize@
77 ENV_CFLAGS
= @sim_env@
78 TIMEBASE_CFLAGS
= @sim_timebase@
79 ALIGNMENT_CFLAGS
= @sim_alignment@
80 FLOAT_CFLAGS
= @sim_float@
81 TRACE_CFLAGS
= @sim_trace@
82 ASSERT_CFLAGS
= @sim_assert@
83 RESERVED_CFLAGS
= @sim_reserved@
84 MONITOR_CFLAGS
= @sim_monitor@
85 MODEL_CFLAGS
= @sim_model@ @sim_default_model@ @sim_model_issue@
86 STDIO_CFLAGS
= @sim_stdio@
87 TERMIO_CFLAGS
= @sim_termio@
88 WARNING_CFLAGS
= @sim_warnings@
89 CONFIG_CFLAGS
= $(BSWAP_CFLAGS
) \
91 $(HOSTENDIAN_CFLAGS
) \
93 $(XOR_ENDIAN_CFLAGS
) \
95 $(HOSTBITSIZE_CFLAGS
) \
108 STD_CFLAGS
= $(CFLAGS
) $(INLINE_CFLAGS
) $(CONFIG_CFLAGS
) $(WARNING_CFLAGS
) $(SIM_CFLAGS
) $(HDEFINES
) $(TDEFINES
) $(INCLUDES
)
109 NOWARN_CFLAGS
= $(CFLAGS
) $(INLINE_CFLAGS
) $(CONFIG_CFLAGS
) $(SIM_CFLAGS
) $(HDEFINES
) $(TDEFINES
) $(INCLUDES
)
110 BUILD_CFLAGS
= -O
$(INCLUDES
) $(WARNING_CFLAGS
)
114 CONFIG_FILE
= @sim_config@
115 IGEN_OPCODE_RULES
= @sim_opcode@
116 IGEN_DUPLICATE
= @sim_dup@
117 IGEN_JUMP
= @sim_jump@
118 IGEN_FILTER
= @sim_filter@
119 IGEN_ICACHE
= @sim_icache@
120 IGEN_SMP
= @sim_igen_smp@
121 IGEN_LINE_NR
= @sim_line_nr@
122 DGEN_FLAGS
= @sim_switch@
124 HDEFINES
= @HDEFINES@
126 IGEN_FLAGS
= $(IGEN_DUPLICATE
) $(IGEN_JUMP
) $(IGEN_FILTER
) $(IGEN_ICACHE
) $(IGEN_SMP
) $(IGEN_LINE_NR
)
131 LIB_INCLUDES
= -I
$(srcdir)/..
/..
/include
132 BFD_INCLUDES
= -I..
/..
/bfd
-I
$(srcdir)/..
/..
/bfd
133 GDB_INCLUDES
= -I..
/..
/gdb
-I
$(srcdir)/..
/..
/gdb
-I
$(srcdir)/..
/..
/gdb
/config
-I
$(srcdir)/..
/..
/mmalloc
134 INCLUDES
= -I.
-I
$(srcdir) $(LIB_INCLUDES
) $(BFD_INCLUDES
) $(GDB_INCLUDES
)
136 LIBIBERTY_LIB
= ..
/..
/libiberty
/libiberty.a
137 BFD_LIB
= ..
/..
/bfd
/libbfd.a
141 all: run
$(TARGETLIB
) $(GDB_OBJ
)
144 $(CC
) -c
$(STD_CFLAGS
) $<
154 debug.h filter_filename.h \
165 idecode_expression.h \
206 BUILT_SRC_WO_CONFIG
= \
208 support.h support.c \
209 idecode.h idecode.c \
210 semantics.h semantics.c \
214 support.h support.c \
220 $(BUILT_SRC_WO_CONFIG
) \
257 # NOTE: semantics, idecode and psim put last so smaller files are compiled
293 GDB_OBJ
= sim_calls.o
330 psim
: $(TARGETLIB
) main.o
$(LIBIBERTY_LIB
) $(BFD_LIB
) $(LIBS
)
331 $(CC
) $(CFLAGS
) $(SIM_CFLAGS
) $(LDFLAGS
) -o psim main.o
$(TARGETLIB
) $(BFD_LIB
) $(LIBIBERTY_LIB
) $(LIBS
)
337 $(TARGETLIB
): tmp-igen tmp-dgen tmp-hw tmp-pk
$(LIB_OBJ
) $(GDB_OBJ
)
339 $(AR
) $(AR_FLAGS
) $(TARGETLIB
) $(LIB_OBJ
) $(GDB_OBJ
)
340 $(RANLIB
) $(TARGETLIB
)
342 # Given that inlines are turned on now, rebuild psim whenever
344 psim.o
: psim.c psim.h
$(CPU_H
) $(IDECODE_H
) $(INLINE
) $(LIB_SRC
) $(BUILT_SRC
)
346 bits.o
: bits.c
$(BASICS_H
)
348 debug.o
: debug.c
$(BASICS_H
)
349 filter_filename.o
: filter_filename.c filter_filename.h config.h ppc-config.h
351 sim-endian.o
: sim-endian.c sim-endian-n.h
$(BASICS_H
)
353 os_emul.o
: os_emul.c emul_netbsd.h emul_unix.h emul_chirp.h emul_bugapi.h
$(EMUL_GENERIC_H
)
354 emul_generic.o
: emul_generic.c
$(EMUL_GENERIC_H
)
356 emul_netbsd.o
: emul_netbsd.c emul_netbsd.h
$(EMUL_GENERIC_H
)
357 emul_unix.o
: emul_unix.c emul_unix.h
$(EMUL_GENERIC_H
)
358 emul_chirp.o
: emul_chirp.c emul_chirp.h
$(EMUL_GENERIC_H
)
359 emul_bugapi.o
: emul_bugapi.c emul_bugapi.h
$(EMUL_GENERIC_H
)
361 registers.o
: registers.c
$(REGISTERS_H
) $(BASICS_H
)
363 cpu.o
: cpu.c
$(CPU_H
) $(IDECODE_H
)
365 interrupts.o
: interrupts.c
$(CPU_H
) $(IDECODE_H
) os_emul.h
367 idecode.o
: idecode.c
$(CPU_H
) $(IDECODE_H
) semantics.h
368 $(CC
) -c
$(NOWARN_CFLAGS
) $<
370 # double.o: double.c dp-bit.c
372 vm.o
: vm.c vm.h vm_n.h
$(BASICS_H
) $(REGISTERS_H
) \
373 device.h corefile.h interrupts.h itable.h mon.h
375 corefile.o
: corefile.c corefile.h corefile-n.h
$(BASICS_H
) $(DEVICE_TABLE_H
)
377 model.o
: model.c
$(CPU_H
)
379 events.o
: events.c events.h
$(BASICS_H
)
381 sim_calls.o
: sim_calls.c
$(PSIM_H
) itable.h ..
/..
/gdb
/tm.h options.h
383 spreg.o
: spreg.c spreg.h spreg.c
$(BASICS_H
)
385 main.o
: main.c
$(PSIM_H
) itable.h options.h
387 device.o
: device.c
$(DEVICE_TABLE_H
) cap.h
389 device_table.o
: device_table.c
$(DEVICE_TABLE_H
) events.h hw.c
391 cap.o
: cap.c cap.h
$(BASICS_H
)
393 semantics.o
: semantics.c semantics.h
$(CPU_H
) $(IDECODE_H
)
394 $(CC
) -c
$(NOWARN_CFLAGS
) $<
396 icache.o
: icache.c icache.h
$(IDECODE_H
) $(CPU_H
)
397 $(CC
) -c
$(NOWARN_CFLAGS
) $<
399 support.o
: support.c support.h
$(IDECODE_H
) $(CPU_H
)
401 itable.o
: itable.c itable.h
403 mon.o
: mon.c
$(CPU_H
)
405 # Rebuild options whenever something changes so the date/time is up to date.
406 options.o
: options.c
$(BASICS_H
) $(CPU_H
) $(IDECODE_H
) $(INLINE
) $(LIB_SRC
) $(BUILT_SRC
) config.status Makefile
407 $(CC
) -c
$(STD_CFLAGS
) '-DOPCODE_RULES="@sim_opcode@"' '-DIGEN_FLAGS="$(IGEN_FLAGS)"' '-DDGEN_FLAGS="$(DGEN_FLAGS)"' $<
410 # Rules to create the built c source code files
413 ppc-config.h
: $(CONFIG_FILE
)
414 cp
$(srcdir)/$(CONFIG_FILE
) ppc-config.h
417 tmp-dgen
: dgen ppc-spr-table
$(srcdir)/..
/..
/move-if-change
418 .
/dgen
$(DGEN_FLAGS
) \
419 -r
$(srcdir)/ppc-spr-table \
420 -n spreg.h
-hp tmp-spreg.h \
421 -n spreg.c
-p tmp-spreg.c
422 $(srcdir)/..
/..
/move-if-change tmp-spreg.h spreg.h
423 $(srcdir)/..
/..
/move-if-change tmp-spreg.c spreg.c
427 tmp-igen
: igen ppc-instructions
$(IGEN_OPCODE_RULES
) ppc-cache-rules
$(srcdir)/..
/..
/move-if-change tmp-ld-decode tmp-ld-cache tmp-ld-insn tmp-filter
428 .
/igen
$(IGEN_FLAGS
) \
429 -o
$(srcdir)/$(IGEN_OPCODE_RULES
) \
430 -k
$(srcdir)/ppc-cache-rules \
431 -i
$(srcdir)/ppc-instructions \
432 -n icache.h
-hc tmp-icache.h \
433 -n icache.c
-c tmp-icache.c \
434 -n semantics.h
-hs tmp-semantics.h \
435 -n semantics.c
-s tmp-semantics.c \
436 -n idecode.h
-hd tmp-idecode.h \
437 -n idecode.c
-d tmp-idecode.c \
438 -n itable.h
-ht tmp-itable.h \
439 -n itable.c
-t tmp-itable.c \
440 -n model.h
-hm tmp-model.h \
441 -n model.c
-m tmp-model.c \
442 -n support.h
-hf tmp-support.h \
443 -n support.c
-f tmp-support.c
444 $(srcdir)/..
/..
/move-if-change tmp-icache.h icache.h
445 $(srcdir)/..
/..
/move-if-change tmp-icache.c icache.c
446 $(srcdir)/..
/..
/move-if-change tmp-idecode.h idecode.h
447 $(srcdir)/..
/..
/move-if-change tmp-idecode.c idecode.c
448 $(srcdir)/..
/..
/move-if-change tmp-semantics.h semantics.h
449 $(srcdir)/..
/..
/move-if-change tmp-semantics.c semantics.c
450 $(srcdir)/..
/..
/move-if-change tmp-itable.h itable.h
451 $(srcdir)/..
/..
/move-if-change tmp-itable.c itable.c
452 $(srcdir)/..
/..
/move-if-change tmp-model.h model.h
453 $(srcdir)/..
/..
/move-if-change tmp-model.c model.c
454 $(srcdir)/..
/..
/move-if-change tmp-support.h support.h
455 $(srcdir)/..
/..
/move-if-change tmp-support.c support.c
458 # NOTE: Some versions of make don't handle files created as side-effects
459 # uncomment the below if that is the case.
461 $(TARGETLIB
): tmp-igen tmp-dgen
462 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
463 spreg.h spreg.c
: tmp-dgen
465 dgen
: dgen.o table.o lf.o misc.o filter_host.o
466 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -o dgen dgen.o table.o lf.o misc.o filter_host.o
$(BUILD_LIBS
)
468 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
469 $(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
)
471 filter_host.c
: filter_filename.c
472 cat
$(srcdir)/filter_filename.c
> filter_host.c
474 filter_host.o
: filter_host.c filter_filename.h config.h ppc-config.h
475 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c filter_host.c
477 table.o
: table.c misc.h filter_filename.h lf.h table.h
478 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/table.c
480 lf.o
: lf.c misc.h filter_filename.h lf.h
481 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/lf.c
483 filter.o
: filter.c misc.h lf.h table.h
filter.h
484 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/filter.c
485 tmp-filter
: filter.c misc.h misc.o
486 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) $(BUILD_LDFLAGS
) -o tmp-filter
-DMAIN
$(srcdir)/filter.c misc.o
$(BUILD_LIBS
)
488 ld-decode.o
: ld-decode.c misc.h lf.h table.h ld-decode.h
489 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/ld-decode.c
490 tmp-ld-decode
: ld-decode.o misc.o lf.o table.o filter_host.o
491 $(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
)
493 ld-cache.o
: ld-cache.c misc.h lf.h table.h ld-cache.h
494 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/ld-cache.c
495 tmp-ld-cache
: ld-cache.o misc.o lf.o table.o filter_host.o
496 $(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
)
498 ld-insn.o
: ld-insn.c misc.h lf.h table.h ld-insn.h ld-decode.h igen.h
499 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/ld-insn.c
500 tmp-ld-insn
: ld-insn.o misc.o lf.o table.o ld-decode.o filter_host.o
filter.o
501 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) $(BUILD_LDFLAGS
) -o tmp-ld-insn
-DMAIN
$(srcdir)/ld-insn.c misc.o lf.o table.o ld-decode.o filter_host.o
filter.o
$(BUILD_LIBS
)
503 gen-model.o
: gen-model.c misc.h lf.h table.h gen-model.h ld-decode.h igen.h ld-insn.h
504 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-model.c
506 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
507 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-itable.c
509 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
510 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-icache.c
512 gen-semantics.o
: gen-semantics.c misc.h lf.h table.h gen-semantics.h ld-decode.h igen.h ld-insn.h
513 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-semantics.c
515 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
516 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-idecode.c
518 gen-support.o
: gen-support.c misc.h lf.h table.h gen-support.h ld-decode.h igen.h ld-insn.h
519 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/gen-support.c
521 dgen.o
: dgen.c misc.h filter_filename.h lf.h table.h
522 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/dgen.c
524 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
525 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/igen.c
527 misc.o
: misc.c misc.h filter_filename.h
528 $(CC_FOR_BUILD
) $(BUILD_CFLAGS
) -c
$(srcdir)/misc.c
533 tmp-hw
: Makefile
$(HW_SRC
) $(srcdir)/..
/..
/move-if-change
534 (cd
$(srcdir); ls
$(HW_SRC
)) \
535 | sed
-e
's/^.*\(hw_.*\)\.c/\1/' \
536 -e
's/^/extern const device_descriptor /' \
537 -e
's/$$/_device_descriptor\[\];/' \
539 (cd
$(srcdir); ls
$(HW_SRC
)) \
540 | sed
-e
's/^.*\(hw_.*\)\.c/\1/' \
542 -e
's/$$/_device_descriptor,/' \
544 $(srcdir)/..
/..
/move-if-change tmp-hw.h hw.h
545 $(srcdir)/..
/..
/move-if-change tmp-hw.c hw.c
548 hw_cpu.o
: hw_cpu.c
$(DEVICE_TABLE_H
)
549 hw_memory.o
: hw_memory.c
$(DEVICE_TABLE_H
)
550 hw_nvram.o
: hw_nvram.c
$(DEVICE_TABLE_H
)
551 hw_iobus.o
: hw_iobus.c
$(DEVICE_TABLE_H
)
552 hw_core.o
: hw_core.c
$(DEVICE_TABLE_H
)
553 hw_pal.o
: hw_pal.c
$(DEVICE_TABLE_H
)
554 hw_htab.o
: hw_htab.c
$(DEVICE_TABLE_H
)
555 hw_disk.o
: hw_disk.c
$(DEVICE_TABLE_H
) pk.h
556 hw_trace.o
: hw_trace.c
$(DEVICE_TABLE_H
)
557 hw_register.o
: hw_register.c
$(DEVICE_TABLE_H
)
558 hw_vm.o
: hw_vm.c
$(DEVICE_TABLE_H
)
559 hw_init.o
: hw_init.c
$(DEVICE_TABLE_H
)
560 # ignore this line, it stops make from getting confused
565 tmp-pk
: Makefile
$(PACKAGE_SRC
) $(srcdir)/..
/..
/move-if-change
566 (cd
$(srcdir); ls
$(PACKAGE_SRC
)) \
567 | sed
-e
's/^pk_\(.*\)\.c/\1/' \
568 -e
's/^/extern package_create_instance_callback pk_/' \
569 -e
's/$$/_create_instance;/' \
571 $(srcdir)/..
/..
/move-if-change tmp-pk.h pk.h
574 pk_disklabel.o
: pk.h
$(DEVICE_TABLE_H
)
575 # ignore this line, it stops make from getting confused
582 etags
$(srcdir)/*.h
$(srcdir)/*.c
$(BUILT_SRC
)
585 rm -f tmp-
* *.
[oasi
] core psim run igen dgen config.log
$(BUILT_SRC_WO_CONFIG
)
587 distclean realclean: clean
588 rm -f TAGS Makefile config.cache config.status config.h stamp-h
590 maintainer-clean
: distclean
591 rm -f
*~
*.log ppc-config.h core
*.core
593 Makefile
: Makefile.in config.status
594 CONFIG_FILES
=Makefile CONFIG_HEADERS
= $(SHELL
) .
/config.status
596 config.h
: stamp-h
; @true
597 stamp-h
: config.in config.status
598 CONFIG_FILES
= CONFIG_HEADERS
=config.h
:config.in
$(SHELL
) .
/config.status
600 config.status
: configure
601 $(SHELL
) .
/config.status
--recheck
604 $(INSTALL_XFORM
) run
$(bindir)/run