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
|
|
|
#
|
|
|
|
# MAINTAINER: rene@FreeBSD.org
|
|
|
|
#
|
|
|
|
# Feature: kmod
|
|
|
|
# Usage: USES=kmod
|
|
|
|
# Valid ARGS: none
|
|
|
|
#
|
|
|
|
.if !defined(_INCLUDE_USES_KMOD_MK)
|
|
|
|
_INCLUDE_USES_KMOD_MK= yes
|
|
|
|
|
2013-11-20 12:43:29 +00:00
|
|
|
_USES_POST= kmod
|
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
.if defined(kmod_ARGS)
|
|
|
|
IGNORE= USES=kmod takes no arguments
|
|
|
|
.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
|
2013-10-31 11:34:46 +00:00
|
|
|
PLIST_SUB+= KMODDIR="${KMODDIR:C,^/,,}"
|
|
|
|
MAKE_ENV+= KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys"
|
2013-11-03 19:41:58 +00:00
|
|
|
.if !defined(NO_STAGE)
|
|
|
|
MAKE_ENV+= NO_XREF=yes
|
|
|
|
.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
|
|
|
|
|
|
|
|
pre-install: ${STAGEDIR}${KMODDIR}
|
|
|
|
${STAGEDIR}${KMODDIR}:
|
2013-12-25 16:43:24 +00:00
|
|
|
@${MKDIR} ${.TARGET}
|
2013-11-20 12:43:29 +00:00
|
|
|
|
2013-10-31 11:34:46 +00:00
|
|
|
kmod-post-install:
|
2013-12-25 16:43:24 +00:00
|
|
|
@${ECHO_CMD} "@exec /usr/sbin/kldxref ${KMODDIR}" >> ${TMPPLIST}
|
|
|
|
@${ECHO_CMD} "@unexec /usr/sbin/kldxref ${KMODDIR}" >> ${TMPPLIST}
|
2013-10-31 11:34:46 +00:00
|
|
|
.if defined(NO_STAGE)
|
|
|
|
/usr/sbin/kldxref ${KMODDIR}
|
|
|
|
.endif
|
2013-11-12 19:44:50 +00:00
|
|
|
.if ${KMODDIR} != /boot/modules
|
2014-01-24 23:08:17 +00:00
|
|
|
@${ECHO_CMD} "@unexec rmdir -p ${KMODDIR} 2>/dev/null || true" \
|
2013-12-25 16:43:24 +00:00
|
|
|
>> ${TMPPLIST}
|
2013-11-12 19:44:50 +00:00
|
|
|
.endif
|
2013-10-31 11:34:46 +00:00
|
|
|
|
|
|
|
.endif
|