dts.mk revision 1.6
1# $NetBSD: dts.mk,v 1.6 2017/12/05 02:57:37 christos Exp $
2
3DTSARCH?=${MACHINE_CPU}
4DTSGNUARCH?=${DTSARCH}
5DTSPADDING?=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
15DTSINC?=$S/external/gpl2/dts/dist/include
16.for _arch in ${DTSARCH}
17DTSDIR+=$S/arch/${_arch}/dts
18.endfor
19.for _arch in ${DTSGNUARCH}
20DTSDIR+=$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})
23DTSDIR+=$S/external/gpl2/dts/dist/arch/${_arch}/boot/dts/${_dir}
24.endif
25.endfor
26.endfor
27
28DTSPATH=${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@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
53DEPS+= ${DTS:.dts=.dtd}
54DTB= ${DTS:.dts=.dtb}
55
56all: ${DTB}
57