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