freebsd-ports/Mk/Uses/kmod.mk
Mathieu Arnold e8796ef612 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

47 lines
955 B
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
PLIST_FILES+= "@kld ${KMODDIR}"
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
_USES_install+= 290:${STAGEDIR}${KMODDIR}
${STAGEDIR}${KMODDIR}:
@${MKDIR} ${.TARGET}
.endif