aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/Uses/kmod.mk
blob: ce37c11718427e9390a0ea9b3a9764f48977d234 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# $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

pre-install: ${STAGEDIR}${KMODDIR}
${STAGEDIR}${KMODDIR}:
    @${MKDIR} ${.TARGET}

.endif