2013-10-31 11:34:46 +00:00
|
|
|
# $FreeBSD$
|
|
|
|
#
|
2013-11-04 09:30:22 +00:00
|
|
|
# Handles common items for kernel module ports.
|
2013-10-31 11:34:46 +00:00
|
|
|
#
|
|
|
|
# Feature: kmod
|
|
|
|
# Usage: USES=kmod
|
2017-02-12 21:53:47 +00:00
|
|
|
# Valid ARGS: (none) debug
|
2013-10-31 11:34:46 +00:00
|
|
|
#
|
2014-03-15 10:31:54 +00:00
|
|
|
# MAINTAINER: rene@FreeBSD.org
|
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
.if !defined(_INCLUDE_USES_KMOD_MK)
|
|
|
|
_INCLUDE_USES_KMOD_MK= yes
|
|
|
|
|
2014-08-07 09:50:22 +00:00
|
|
|
_USES_POST+= kmod
|
2013-11-20 12:43:29 +00:00
|
|
|
|
2017-02-12 21:53:47 +00:00
|
|
|
.if empty(kmod_ARGS)
|
|
|
|
_DEBUG_KMOD=
|
|
|
|
.elif ${kmod_ARGS} == "debug"
|
|
|
|
_DEBUG_KMOD= yes
|
|
|
|
.else
|
|
|
|
IGNORE= USES=kmod takes either no arguments or 'debug'
|
2013-10-31 11:34:46 +00:00
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !exists(${SRC_BASE}/sys/Makefile)
|
|
|
|
IGNORE= requires kernel source files in ${SRC_BASE}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CATEGORIES+= kld
|
|
|
|
|
2014-01-24 23:08:17 +00:00
|
|
|
SSP_UNSAFE= kernel module supports SSP natively
|
2013-10-31 11:34:46 +00:00
|
|
|
|
2013-11-12 11:40:54 +00:00
|
|
|
KMODDIR?= /boot/modules
|
2013-11-12 19:44:50 +00:00
|
|
|
.if ${KMODDIR} == /boot/kernel
|
2013-11-08 09:44:24 +00:00
|
|
|
KMODDIR= /boot/modules
|
|
|
|
.endif
|
2017-02-13 21:48:12 +00:00
|
|
|
|
|
|
|
_DEBUG_KMOD_SH= \
|
|
|
|
${ECHO_CMD} -n "\"@dir /%%KERN_DEBUGDIR%%/%%KMODDIR%%\"" ; \
|
|
|
|
skd=`${ECHO_CMD} ${KMODDIR} | ${SED} "s,/, ,g"` ; \
|
|
|
|
l=`${ECHO_CMD} $$skd | wc -w` ; \
|
|
|
|
while [ $$l -gt 0 ] ; do \
|
|
|
|
c=0 ; \
|
|
|
|
r="" ; \
|
|
|
|
for p in $$skd ; do \
|
|
|
|
c=$$(($$c+1)) ; \
|
|
|
|
if [ $$c -eq $$l ] ; then \
|
|
|
|
break ; \
|
|
|
|
fi ; \
|
|
|
|
r="$$r/$$p" ; \
|
|
|
|
done ; \
|
|
|
|
${ECHO_CMD} -n " \"@dir /%%KERN_DEBUGDIR%%$$r\"" ; \
|
|
|
|
l=$$(($$l-1)) ; \
|
|
|
|
done
|
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
PLIST_SUB+= KMODDIR="${KMODDIR:C,^/,,}"
|
2014-01-31 18:00:55 +00:00
|
|
|
MAKE_ENV+= KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys" NO_XREF=yes
|
2014-12-26 12:43:44 +00:00
|
|
|
PLIST_FILES+= "@kld ${KMODDIR}"
|
2013-10-31 11:34:46 +00:00
|
|
|
|
2014-06-22 21:01:11 +00:00
|
|
|
STRIP_CMD+= --strip-debug # do not strip kernel symbols
|
2017-02-12 21:53:47 +00:00
|
|
|
.if !empty(_DEBUG_KMOD)
|
2016-12-09 18:47:09 +00:00
|
|
|
KERN_DEBUGDIR?= ${DEBUGDIR}
|
2017-02-12 21:53:47 +00:00
|
|
|
PLIST_SUB+= KERN_DEBUGDIR="${KERN_DEBUGDIR:C,^/,,}"
|
|
|
|
MAKE_ENV+= KERN_DEBUGDIR="${KERN_DEBUGDIR}"
|
2017-02-13 21:48:12 +00:00
|
|
|
_KMOD_DIRS!= ${_DEBUG_KMOD_SH}
|
|
|
|
PLIST_FILES+= ${_KMOD_DIRS}
|
2017-02-12 21:53:47 +00:00
|
|
|
.endif
|
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
.endif
|
|
|
|
|
2013-11-20 12:43:29 +00:00
|
|
|
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_KMOD_POST_MK)
|
|
|
|
_INCLUDE_USES_KMOD_POST_MK= yes
|
|
|
|
|
Rewrite the target ordering code.
The targets now have priority assigned to them, and, when the dependency
ordering magic is done at the end of bsd.port.mk, they are sorted
according to their priority.
This allows USES to add targets easily and have them run whenever they
want without touching bsd.port.mk.
To add a target that runs just before post-configure run, do:
_USES_configure+= 695:my-post-configure
my-post-configure:
do something
To fine tune when the target is ran, look at the values in the *_SEQ
variables at the end of bsd.port.mk, and the other USES.
Allow ports Makefiles to override the priority of targets with the
TARGET_ORDER_OVERRIDE variable. For example, to get post-install
running earlier, (its default is 700) do:
TARGET_ORDER_OVERRIDE= 650:post-install
While there, add options target helpers for the do-* targets when they
exist.
Reviewed by: antoine, bapt
Exp-run by: antoine
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3099
2015-08-17 13:31:25 +00:00
|
|
|
_USES_install+= 290:${STAGEDIR}${KMODDIR}
|
2013-11-20 12:43:29 +00:00
|
|
|
${STAGEDIR}${KMODDIR}:
|
2013-12-25 16:43:24 +00:00
|
|
|
@${MKDIR} ${.TARGET}
|
2013-11-20 12:43:29 +00:00
|
|
|
|
2017-02-12 21:53:47 +00:00
|
|
|
.if !empty(_DEBUG_KMOD)
|
|
|
|
_USES_install+= 291:${STAGEDIR}${KERN_DEBUGDIR}${KMODDIR}
|
2016-12-09 18:47:09 +00:00
|
|
|
${STAGEDIR}${KERN_DEBUGDIR}${KMODDIR}:
|
|
|
|
@${MKDIR} ${.TARGET}
|
2016-12-12 20:53:11 +00:00
|
|
|
.endif
|
2016-12-09 18:47:09 +00:00
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
.endif
|