1 1.12 christos # $NetBSD: dts.mk,v 1.12 2019/04/24 20:53:10 christos Exp $ 2 1.3 jmcneill 3 1.3 jmcneill DTSARCH?=${MACHINE_CPU} 4 1.3 jmcneill DTSGNUARCH?=${DTSARCH} 5 1.3 jmcneill DTSPADDING?=1024 6 1.1 christos 7 1.6 christos .if !make(obj) && !make(clean) && !make(cleandir) 8 1.8 christos .BEGIN:: 9 1.7 christos -@mkdir -p dts 10 1.4 christos .for _arch in ${DTSGNUARCH} 11 1.12 christos -@ln -snf ${S:S@^../@../../@}/external/gpl2/dts/dist/arch/${_arch}/boot/dts dts/${_arch} 12 1.4 christos .endfor 13 1.6 christos .endif 14 1.4 christos 15 1.1 christos DTSINC?=$S/external/gpl2/dts/dist/include 16 1.3 jmcneill .for _arch in ${DTSARCH} 17 1.3 jmcneill DTSDIR+=$S/arch/${_arch}/dts 18 1.3 jmcneill .endfor 19 1.3 jmcneill .for _arch in ${DTSGNUARCH} 20 1.3 jmcneill DTSDIR+=$S/external/gpl2/dts/dist/arch/${_arch}/boot/dts 21 1.3 jmcneill .for _dir in ${DTSSUBDIR} 22 1.3 jmcneill .if exists($S/external/gpl2/dts/dist/arch/${_arch}/boot/dts/${_dir}) 23 1.3 jmcneill DTSDIR+=$S/external/gpl2/dts/dist/arch/${_arch}/boot/dts/${_dir} 24 1.3 jmcneill .endif 25 1.3 jmcneill .endfor 26 1.3 jmcneill .endfor 27 1.3 jmcneill 28 1.10 thorpej DTSPATH=${DTSINC} ${DTSDIR} ${DTS_OVERLAYDIR} dts 29 1.1 christos 30 1.10 thorpej .SUFFIXES: .dtd .dtdo .dtb .dtbo .dts 31 1.1 christos 32 1.1 christos .dts.dtd: 33 1.3 jmcneill (${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 34 1.3 jmcneill -include ${.IMPSRC} /dev/null | \ 35 1.3 jmcneill ${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \ 36 1.9 jakllsch -p ${DTSPADDING} -b 0 -@ -o /dev/null -d /dev/stdout | \ 37 1.2 christos ${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtd=.dtb}@' \ 38 1.2 christos -e 's@<stdin>@${.IMPSRC}@' && \ 39 1.3 jmcneill ${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 40 1.3 jmcneill -include ${.IMPSRC} -M /dev/null | \ 41 1.2 christos ${TOOL_SED} -e 's (a] null.o@${.TARGET:.dtd=.dtb}@' \ 42 1.2 christos -e 's@/dev/null@@') > ${.TARGET} 43 1.2 christos 44 1.10 thorpej .dts.dtdo: 45 1.10 thorpej (${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 46 1.10 thorpej -include ${.IMPSRC} /dev/null | \ 47 1.10 thorpej ${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \ 48 1.10 thorpej -@ -o /dev/null -d /dev/stdout | \ 49 1.10 thorpej ${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtdo=.dtbo}@' \ 50 1.10 thorpej -e 's@<stdin>@${.IMPSRC}@' && \ 51 1.10 thorpej ${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 52 1.10 thorpej -include ${.IMPSRC} -M /dev/null | \ 53 1.10 thorpej ${TOOL_SED} -e 's (a] null.o@${.TARGET:.dtdo=.dtbo}@' \ 54 1.10 thorpej -e 's@/dev/null@@') > ${.TARGET} 55 1.1 christos 56 1.1 christos .dts.dtb: 57 1.3 jmcneill ${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 58 1.3 jmcneill -include ${.IMPSRC} /dev/null | \ 59 1.3 jmcneill ${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \ 60 1.9 jakllsch -p ${DTSPADDING} -b 0 -@ -o ${.TARGET} 61 1.1 christos 62 1.10 thorpej .dts.dtbo: 63 1.10 thorpej ${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \ 64 1.10 thorpej -include ${.IMPSRC} /dev/null | \ 65 1.10 thorpej ${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \ 66 1.10 thorpej -@ -o ${.TARGET} 67 1.10 thorpej 68 1.10 thorpej .PATH.dts: ${DTSDIR} ${DTS_OVERLAYDIR} 69 1.1 christos 70 1.1 christos DEPS+= ${DTS:.dts=.dtd} 71 1.10 thorpej DEPS+= ${DTS_OVERLAYS:.dts=.dtdo} 72 1.10 thorpej DTB= ${DTS:.dts=.dtb} 73 1.10 thorpej DTBO= ${DTS_OVERLAYS:.dts=.dtbo} 74 1.1 christos 75 1.10 thorpej all: ${DTB} ${DTBO} 76