Home | History | Annotate | Line # | Download | only in libsim
      1  1.11  christos #	$NetBSD: Makefile,v 1.11 2025/08/27 15:23:25 christos Exp $
      2   1.1  christos 
      3   1.1  christos LIBISPRIVATE=	yes
      4   1.1  christos NOGCCERROR=
      5   1.1  christos 
      6   1.1  christos .include <bsd.own.mk>
      7   1.1  christos .include "../Makefile.inc"
      8   1.1  christos 
      9   1.1  christos LIB=	sim
     10  1.11  christos SRCS=	debug.c bits.c sim-endian.c os_emul.c emul_generic.c \
     11   1.1  christos 	emul_bugapi.c emul_chirp.c emul_netbsd.c emul_unix.c registers.c vm.c \
     12   1.1  christos 	corefile.c model.c spreg.c cpu.c interrupts.c events.c cap.c device.c \
     13   1.1  christos 	tree.c device_table.c itable.c mon.c icache.c semantics.c idecode.c \
     14   1.1  christos 	support.c psim.c pk_disklabel.c hw_cpu.c hw_memory.c hw_nvram.c \
     15   1.1  christos 	hw_iobus.c hw_htab.c hw_disk.c hw_trace.c hw_register.c hw_vm.c \
     16   1.1  christos 	hw_init.c hw_core.c hw_pal.c hw_com.c hw_eeprom.c hw_opic.c hw_glue.c \
     17  1.10  christos 	hw_phb.c hw_ide.c options.c sim_calls.c callback.c gdb-sim.c
     18  1.10  christos SRCS+=	target-newlib-errno.c target-newlib-open.c target-newlib-signal.c \
     19  1.10  christos 	target-newlib-syscall.c
     20   1.1  christos 
     21   1.1  christos MIC=	${HOST_SH} ${DIST}/move-if-change
     22   1.1  christos 
     23   1.1  christos HOST_CPPFLAGS+=	-I. \
     24  1.11  christos 		-I${DIST}/sim/common \
     25  1.11  christos 		-I${DIST}/sim/igen \
     26   1.1  christos 		-I${DIST}/sim/ppc -I${DIST}/include \
     27   1.1  christos 		-I${.CURDIR}/arch/${GDB_MACHINE_ARCH} \
     28   1.1  christos 		-I${.CURDIR}/../libbfd/arch/${GDB_MACHINE_ARCH} \
     29  1.10  christos 		-I${.CURDIR}/../libgnulib/arch/${GDB_MACHINE_ARCH} \
     30  1.11  christos 		-I${.CURDIR}/../libgdbsupport/arch/${GDB_MACHINE_ARCH} \
     31   1.1  christos 		-I${DIST}/bfd \
     32   1.1  christos 		-I${DIST}/gdb \
     33   1.1  christos 		-I${DIST}/gdb/config \
     34   1.1  christos 		-DHAVE_COMMON_FPU \
     35   1.1  christos 		-I${.CURDIR}/../arch/${GDB_MACHINE_ARCH} \
     36  1.11  christos 		-I${DIST}/gnulib/import
     37   1.1  christos PSIM_DEFINES=	-DHAVE_CONFIG_H \
     38  1.10  christos 		-DDEFAULT_INLINE=INLINE_LOCALS \
     39   1.1  christos 		-DWITH_HOST_BYTE_ORDER=BYTE_ORDER \
     40   1.1  christos 		-DWITH_SMP=5 \
     41  1.10  christos 		-DSIM_COMMON_BUILD \
     42  1.11  christos 		-DSIM_TOPDIR_BUILD \
     43   1.1  christos 		-DHAVE_TERMIOS_STRUCTURE \
     44  1.10  christos 		-DHAVE_DEVZERO  \
     45  1.10  christos 		-DWITH_TRACE=0 \
     46  1.10  christos 		-DWITH_ASSERT=0 \
     47  1.10  christos 		-DWITH_STDIO=0 \
     48  1.10  christos 		-DWITH_ENVIRONMENT=0 \
     49  1.10  christos 		-DWITH_RESERVED_BITS=0 \
     50  1.10  christos 		-DREPORT_BUGS_TO=\"gnats (at] NetBSD.org\" \
     51  1.10  christos 		-DPKGVERSION=\"13.2\"
     52   1.1  christos 
     53   1.1  christos # we need the same -I flags for host / target.
     54   1.1  christos CPPFLAGS+=	${HOST_CPPFLAGS} ${PSIM_DEFINES}
     55   1.1  christos 
     56   1.1  christos #
     57   1.1  christos # These portions run several programs to generate more code to compile.
     58   1.1  christos #
     59   1.1  christos 
     60   1.1  christos # igen portion
     61   1.1  christos IGEN_FLAGS=	-E    -F 32,f,o  -CSRI 1024  -N 5 \
     62   1.1  christos 	-o ${DIST}/sim/ppc/dc-complex \
     63  1.10  christos 	-I ${DIST}/sim/ppc -i ${DIST}/sim/ppc/powerpc.igen \
     64   1.1  christos 	-n icache.h    -hc tmp-icache.h \
     65   1.1  christos 	-n icache.c    -c  tmp-icache.c \
     66   1.1  christos 	-n semantics.h -hs tmp-semantics.h \
     67   1.1  christos 	-n semantics.c -s  tmp-semantics.c \
     68   1.1  christos 	-n idecode.h   -hd tmp-idecode.h \
     69   1.1  christos 	-n idecode.c   -d  tmp-idecode.c \
     70   1.1  christos 	-n itable.h    -ht tmp-itable.h \
     71   1.1  christos 	-n itable.c    -t  tmp-itable.c \
     72   1.1  christos 	-n model.h     -hm tmp-model.h \
     73   1.1  christos 	-n model.c     -m  tmp-model.c \
     74   1.1  christos 	-n support.h   -hf tmp-support.h \
     75   1.1  christos 	-n support.c   -f  tmp-support.c
     76   1.1  christos IGENED_FILES=	icache.h icache.c idecode.h idecode.c semantics.h semantics.c \
     77   1.1  christos 		itable.h itable.c model.h model.c support.h support.c
     78  1.11  christos IGENSRCS= igen.c table.c lf.c misc.c filter_host.c ld-decode.c ld-cache.c filter.c ld-insn.c gen-model.c gen-itable.c gen-icache.c gen-semantics.c gen-idecode.c gen-support.c lf-ppc.c dumpf.c filter-ppc.c
     79   1.1  christos IGENOBJS= ${IGENSRCS:S/.c/.lo/}
     80   1.1  christos DPSRCS+= ${IGENED_FILES:M*.h}
     81   1.1  christos 
     82   1.1  christos ${IGENED_FILES}: run-igen
     83  1.10  christos run-igen: igen powerpc.igen
     84   1.1  christos 	${_MKMSG_CREATE} ${IGENED_FILES}
     85   1.1  christos 	rm -f ${.TARGET}
     86   1.1  christos 	./igen ${IGEN_FLAGS}
     87   1.1  christos 	${MIC} tmp-icache.h icache.h
     88   1.1  christos 	${MIC} tmp-icache.c icache.c
     89   1.1  christos 	${MIC} tmp-idecode.h idecode.h
     90   1.1  christos 	${MIC} tmp-idecode.c idecode.c
     91   1.1  christos 	${MIC} tmp-semantics.h semantics.h
     92   1.1  christos 	${MIC} tmp-semantics.c semantics.c
     93   1.1  christos 	${MIC} tmp-itable.h itable.h
     94   1.1  christos 	${MIC} tmp-itable.c itable.c
     95   1.1  christos 	${MIC} tmp-model.h model.h
     96   1.1  christos 	${MIC} tmp-model.c model.c
     97   1.1  christos 	${MIC} tmp-support.h support.h
     98   1.1  christos 	${MIC} tmp-support.c support.c
     99   1.1  christos 	touch ${.TARGET}
    100   1.1  christos 
    101   1.1  christos igen: ${IGENOBJS}
    102   1.1  christos 	${HOST_LINK.c} ${IGENOBJS} -o ${.TARGET}
    103   1.1  christos 
    104   1.1  christos # dgen portion
    105  1.11  christos #DGEN_FLAGS=	-r ${DIST}/sim/ppc/ppc-spr-table \
    106  1.11  christos #	-n spreg.h     -hp tmp-spreg.h \
    107  1.11  christos #	-n spreg.c     -p  tmp-spreg.c
    108  1.11  christos #DGENED_FILES=	spreg.h spreg.c
    109  1.11  christos #DGENSRCS= dgen.c table.c lf.c misc.c filter_host.c
    110  1.11  christos #DGENOBJS= ${DGENSRCS:S/.c/.lo/}
    111  1.11  christos #DPSRCS+= ${DGENED_FILES:M*.h}
    112  1.11  christos 
    113  1.11  christos #${DGENED_FILES}: run-dgen
    114  1.11  christos #run-dgen: dgen
    115  1.11  christos #	./dgen ${DGEN_FLAGS}
    116  1.11  christos #	${MIC} tmp-spreg.h spreg.h
    117  1.11  christos #	${MIC} tmp-spreg.c spreg.c
    118  1.11  christos #	touch run-dgen
    119  1.11  christos #
    120  1.11  christos #dgen: ${DGENOBJS}
    121  1.11  christos #	${HOST_LINK.c} ${DGENOBJS} -o ${.TARGET}
    122   1.1  christos 
    123   1.1  christos # hw.c / hw.h portion
    124   1.1  christos HWSRCS=	hw_cpu.c hw_memory.c hw_nvram.c hw_iobus.c hw_htab.c hw_disk.c \
    125   1.1  christos 	hw_trace.c hw_register.c hw_vm.c hw_init.c hw_core.c hw_pal.c \
    126   1.1  christos 	hw_com.c hw_eeprom.c hw_opic.c hw_glue.c hw_phb.c hw_ide.c
    127   1.1  christos 
    128   1.1  christos hw.h hw.c: run-hw
    129   1.1  christos run-hw: Makefile
    130   1.1  christos 	f=""; \
    131   1.1  christos 	for i in ${HWSRCS}; do \
    132   1.1  christos 		case " $$f " in \
    133   1.1  christos 			*" $$i "*) ;; \
    134   1.1  christos 			*) f="$$f $$i" ;; \
    135   1.1  christos 		esac ; \
    136   1.1  christos 	done ; \
    137   1.1  christos 	for hw in $$f; do \
    138   1.1  christos 		echo $$hw; \
    139   1.1  christos 	done | ${TOOL_SED} -e 's/^.*\(hw_.*\)\.c/\1/' \
    140   1.1  christos 		   -e 's/^/extern const device_descriptor /' \
    141   1.1  christos 		   -e 's/$$/_device_descriptor\[\];/' \
    142   1.1  christos 			> tmp-hw.h
    143   1.1  christos 	f=""; \
    144   1.1  christos 	for i in ${HWSRCS}; do \
    145   1.1  christos 		case " $$f " in \
    146   1.1  christos 			*" $$i "*) ;; \
    147   1.1  christos 			*) f="$$f $$i" ;; \
    148   1.1  christos 		esac ; \
    149   1.1  christos 	done ; \
    150   1.1  christos 	for hw in $$f; do \
    151   1.1  christos 		echo $$hw; \
    152   1.1  christos 	done | ${TOOL_SED} -e 's/^.*\(hw_.*\)\.c/\1/' \
    153   1.1  christos 		   -e 's/^/    /' \
    154   1.1  christos 		   -e 's/$$/_device_descriptor,/' > tmp-hw.c
    155   1.1  christos 	${MIC} tmp-hw.h hw.h
    156   1.1  christos 	${MIC} tmp-hw.c hw.c
    157   1.1  christos 	touch run-hw
    158   1.1  christos DPSRCS+= hw.h
    159   1.1  christos 
    160   1.1  christos # package portion
    161   1.1  christos PACKAGE_SRC =	pk_disklabel.c
    162   1.1  christos PK_H = 		pk.h
    163   1.1  christos 
    164   1.1  christos ${PK_H}: run-pk
    165   1.1  christos run-pk: $(PACKAGE_SRC)
    166   1.1  christos 	f=""; \
    167   1.1  christos 	for i in $(PACKAGE_SRC) ; do \
    168   1.1  christos 		case " $$f " in \
    169   1.1  christos 			*" $$i "*) ;; \
    170   1.1  christos 			*) f="$$f $$i" ;; \
    171   1.1  christos 		esac ; \
    172   1.1  christos 	done ; \
    173   1.1  christos 	for pk in $$f; do \
    174   1.1  christos 		echo $$pk; \
    175   1.1  christos 	done | ${TOOL_SED} -e 's/^.*pk_\(.*\)\.c/\1/' \
    176   1.1  christos 		   -e 's/^/extern package_create_instance_callback pk_/' \
    177   1.1  christos 		   -e 's/$$/_create_instance;/' > tmp-pk.h
    178   1.1  christos 	${MIC} tmp-pk.h pk.h
    179   1.1  christos 	touch run-pk
    180   1.1  christos DPSRCS+= ${PK_H}
    181   1.1  christos 
    182   1.1  christos # defines portion
    183   1.1  christos DEFINES_H=	defines.h
    184   1.1  christos ${DEFINES_H}: run-defines
    185   1.1  christos run-defines:
    186   1.1  christos 	${TOOL_SED} -n -e '/^#define HAVE_/s/ 1$$/",/' \
    187   1.1  christos 	       -e '/^#define HAVE_/s//"HAVE_/p' \
    188   1.1  christos 	       < ${.CURDIR}/arch/${GDB_MACHINE_ARCH}/config.h > tmp-defines.h
    189   1.1  christos 	${MIC} tmp-defines.h defines.h
    190   1.1  christos 	touch run-defines
    191   1.1  christos DPSRCS+= ${DEFINES_H}
    192   1.1  christos 
    193  1.11  christos # misc. dependencies.
    194  1.11  christos #filter_host.lo: ppc-config.h
    195  1.11  christos 
    196  1.11  christos #ppc-config.h: ${DIST}/sim/ppc/std-config.h
    197  1.11  christos #	cp -f ${.ALLSRC} ${.TARGET}
    198  1.11  christos #DPSRCS+= ppc-config.h
    199   1.1  christos 
    200   1.1  christos CLEANFILES+=	igen dgen gentmap *.lo \
    201  1.11  christos 		ppc-config.h \
    202   1.1  christos 		tmp-icache.h icache.h \
    203   1.1  christos 		tmp-icache.c icache.c \
    204   1.1  christos 		tmp-idecode.h idecode.h \
    205   1.1  christos 		tmp-idecode.c idecode.c \
    206   1.1  christos 		tmp-semantics.h semantics.h \
    207   1.1  christos 		tmp-semantics.c semantics.c \
    208   1.1  christos 		tmp-itable.h itable.h \
    209   1.1  christos 		tmp-itable.c itable.c \
    210   1.1  christos 		tmp-model.h model.h \
    211   1.1  christos 		tmp-model.c model.c \
    212   1.1  christos 		tmp-support.h support.h \
    213   1.1  christos 		tmp-support.c support.c \
    214   1.1  christos 		tmp-spreg.h spreg.h \
    215   1.1  christos 		tmp-spreg.c spreg.c \
    216   1.1  christos 		tmp-vals.h targ-vals.h \
    217   1.1  christos 		hw.c hw.h \
    218   1.1  christos 		defines.h pk.h \
    219   1.1  christos 		targ-map.c targ-vals.def \
    220   1.1  christos 		run-defines run-dgen run-hw run-igen run-pk
    221   1.1  christos 
    222   1.1  christos .SUFFIXES: .lo
    223   1.1  christos .c.lo:
    224   1.1  christos 	${HOST_COMPILE.c} -o ${.TARGET} $<
    225   1.1  christos 
    226  1.11  christos .PATH: ${DIST}/sim/ppc ${DIST}/sim/common ${DIST}/sim/igen
    227   1.1  christos 
    228   1.1  christos .include <bsd.lib.mk>
    229   1.1  christos .include "../../Makefile.inc"
    230