1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00
freebsd-ports/Mk/Uses/kmod.mk
Tijl Coosemans fe837ee6c6 Change the way USES is handled:
- Loop over USES twice, once to define all *_ARGS variables and once to
  include Uses/*.mk.  This allows all Uses/*.mk to examine arguments given
  to other USES entries.
- Always define *_ARGS (possibly empty) and replace commas with spaces.

Similar for _USES_POST.

Adjust all Uses/*.mk:
- defined(u_ARGS) becomes !empty(u_ARGS)
- Eliminate helper variables like _*_ARGS=${*_ARGS:C/,/ /g}
- Some Uses/*.mk used ":" as argument separator instead of ",", but no port
  used this form
- Uses/cran.mk: remove unused variable VALID_ARGS and USES+=fortran which
  has no effect
- Uses/twisted.mk: simplify handling of the case where neither "build" nor
  "run" arguments have been specified

PR:		193931
Exp-run by:	antoine
Approved by:	portmgr (antoine)
2014-09-28 16:36:31 +00:00

54 lines
1.2 KiB
Makefile

# $FreeBSD$
#
# Handles common items for kernel module ports.
#
# Feature: kmod
# Usage: USES=kmod
# Valid ARGS: none
#
# MAINTAINER: rene@FreeBSD.org
.if !defined(_INCLUDE_USES_KMOD_MK)
_INCLUDE_USES_KMOD_MK= yes
_USES_POST+= kmod
.if !empty(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
SSP_UNSAFE= kernel module supports SSP natively
KMODDIR?= /boot/modules
.if ${KMODDIR} == /boot/kernel
KMODDIR= /boot/modules
.endif
PLIST_SUB+= KMODDIR="${KMODDIR:C,^/,,}"
MAKE_ENV+= KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys" NO_XREF=yes
STRIP_CMD+= --strip-debug # do not strip kernel symbols
.endif
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_KMOD_POST_MK)
_INCLUDE_USES_KMOD_POST_MK= yes
pre-install: ${STAGEDIR}${KMODDIR}
${STAGEDIR}${KMODDIR}:
@${MKDIR} ${.TARGET}
kmod-post-install:
@${ECHO_CMD} "@exec /usr/sbin/kldxref ${KMODDIR}" >> ${TMPPLIST}
@${ECHO_CMD} "@unexec /usr/sbin/kldxref ${KMODDIR}" >> ${TMPPLIST}
.if ${KMODDIR} != /boot/modules
@${ECHO_CMD} "@unexec rmdir -p ${KMODDIR} 2>/dev/null || true" \
>> ${TMPPLIST}
.endif
.endif