Home | History | Annotate | Line # | Download | only in conf
dts.mk revision 1.6
      1 # $NetBSD: dts.mk,v 1.6 2017/12/05 02:57:37 christos Exp $
      2 
      3 DTSARCH?=${MACHINE_CPU}
      4 DTSGNUARCH?=${DTSARCH}
      5 DTSPADDING?=1024
      6 
      7 .if !make(obj) && !make(clean) && !make(cleandir)
      8 .BEGIN:
      9 	@mkdir -p dts
     10 .for _arch in ${DTSGNUARCH}
     11 	@ln -sf ${S:S@^../@../../@}/external/gpl2/dts/dist/arch/${_arch}/boot/dts dts/${_arch}
     12 .endfor
     13 .endif
     14 
     15 DTSINC?=$S/external/gpl2/dts/dist/include
     16 .for _arch in ${DTSARCH}
     17 DTSDIR+=$S/arch/${_arch}/dts
     18 .endfor
     19 .for _arch in ${DTSGNUARCH}
     20 DTSDIR+=$S/external/gpl2/dts/dist/arch/${_arch}/boot/dts
     21 .for _dir in ${DTSSUBDIR}
     22 .if exists($S/external/gpl2/dts/dist/arch/${_arch}/boot/dts/${_dir})
     23 DTSDIR+=$S/external/gpl2/dts/dist/arch/${_arch}/boot/dts/${_dir}
     24 .endif
     25 .endfor
     26 .endfor
     27 
     28 DTSPATH=${DTSINC} ${DTSDIR} dts
     29 
     30 .SUFFIXES: .dtd .dtb .dts
     31 
     32 .dts.dtd:
     33 	(${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \
     34 	    -include ${.IMPSRC} /dev/null | \
     35 	${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \
     36 	    -p ${DTSPADDING} -b 0 -o /dev/null -d /dev/stdout | \
     37 	${TOOL_SED} -e 's@/dev/null@${.TARGET:.dtd=.dtb}@' \
     38 	    -e 's@<stdin>@${.IMPSRC}@' && \
     39 	${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \
     40 	    -include ${.IMPSRC} -M /dev/null | \
     41 	${TOOL_SED} -e 's (a] null.o@${.TARGET:.dtd=.dtb}@' \
     42 	    -e 's@/dev/null@@') > ${.TARGET}
     43 
     44 
     45 .dts.dtb:
     46 	${CPP} -P -xassembler-with-cpp ${DTSPATH:@v@-I ${v}@} \
     47 	    -include ${.IMPSRC} /dev/null | \
     48 	${TOOL_DTC} ${DTSPATH:@v@-i ${v}@} -I dts -O dtb \
     49 	    -p ${DTSPADDING} -b 0 -o ${.TARGET}
     50 
     51 .PATH.dts: ${DTSDIR}
     52 
     53 DEPS+= ${DTS:.dts=.dtd}
     54 DTB= ${DTS:.dts=.dtb}
     55 
     56 all: ${DTB}
     57