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