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" 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/) 37SYSDIR= ${_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 48DTBDIR?=/boot/dtb 49DTB=${DTS:R:S/$/.dtb/} 50 51all: ${DTB} 52 53.if defined(DTS) 54.for _dts in ${DTS} 55${_dts:R:S/$/.dtb/}: ${_dts} 56 @echo Generating ${.TARGET} from ${_dts} 57 @${SYSDIR}/tools/fdt/make_dtb.sh ${SYSDIR} ${_dts} ${.OBJDIR} 58CLEANFILES+=${_dts:R:S/$/.dtb/} 59.endfor 60.endif 61 62.if !target(install) 63.if !target(realinstall) 64realinstall: _dtbinstall 65.ORDER: beforeinstall _kmodinstall 66_dtbinstall: 67.for _dtb in ${DTB} 68 ${INSTALL} -o ${DTBOWN} -g ${DTBGRP} -m ${DTBMODE} \ 69 ${_INSTALLFLAGS} ${_dtb} ${DESTDIR}${DTBDIR} 70.endfor 71.endif # !target(realinstall) 72.endif # !target(install) 73 74.include <bsd.dep.mk> 75.include <bsd.obj.mk> 76