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