]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - sys/conf/dtb.mk
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / sys / conf / dtb.mk
1 # $FreeBSD$
2 #
3 # The include file <dtb.mk> handles building and installing dtb files.
4 #
5 # +++ variables +++
6 #
7 # DTS           List of the dts files to build and install.
8 #
9 # DTBDIR        Base path for dtb modules [/boot/dtb]
10 #
11 # DTBOWN        .dtb file owner. [${BINOWN}]
12 #
13 # DTBGRP        .dtb file group. [${BINGRP}]
14 #
15 # DTBMODE       Module file mode. [${BINMODE}]
16 #
17 # DESTDIR       The tree where the module gets installed. [not set]
18 #
19 # +++ targets +++
20 #
21 #       install:
22 #               install the kernel module; if the Makefile
23 #               does not itself define the target install, the targets
24 #               beforeinstall and afterinstall may also be used to cause
25 #               actions immediately before and after the install target
26 #               is executed.
27 #
28
29 .include <bsd.init.mk>
30 # Grab all the options for a kernel build. For backwards compat, we need to
31 # do this after bsd.own.mk.
32 #.include "kern.opts.mk" # commented out to minize difference with 11.x and newer
33
34 # Search for kernel source tree in standard places.
35 .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys
36 .if !defined(SYSDIR) && exists(${_dir}/kern/)
37 SYSDIR= ${_dir}
38 .endif
39 .endfor
40 .if !defined(SYSDIR) || !exists(${SYSDIR}/kern/)
41 .error "can't find kernel source tree"
42 .endif
43
44 .SUFFIXES: .dtb .dts
45
46 .PATH: ${SYSDIR}/gnu/dts/${MACHINE} ${SYSDIR}/boot/fdt/dts/${MACHINE}
47
48 DTB=${DTS:R:S/$/.dtb/}
49
50 all: ${DTB}
51
52 .if defined(DTS)
53 .for _dts in ${DTS}
54 ${_dts:R:S/$/.dtb/}:    ${_dts}
55         @echo Generating ${.TARGET} from ${_dts}
56         @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR}
57 CLEANFILES+=${_dts:R:S/$/.dtb/}
58 .endfor
59 .endif
60
61 .if !target(install)
62 .if !target(realinstall)
63 realinstall: _dtbinstall
64 .ORDER: beforeinstall _kmodinstall
65 _dtbinstall:
66 # Need to create this because installkernel doesn't invoke mtree with BSD.root.mtree
67 # to make sure the tree is setup properly. This may break ownership of ${DTBDIR}
68 # for no-root build.
69         mkdir -p ${DESTDIR}${DTBDIR}
70 .for _dtb in ${DTB}
71         ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \
72             ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR}
73 .endfor
74 .endif # !target(realinstall)
75 .endif # !target(install)
76
77 .include <bsd.dep.mk>
78 .include <bsd.obj.mk>