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