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