summaryrefslogtreecommitdiff
path: root/Mk/Uses/kmod.mk
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2017-02-12 21:53:47 +0000
committerRene Ladan <rene@FreeBSD.org>2017-02-12 21:53:47 +0000
commit7741cace34b6569078483c3f851a90caf06bf905 (patch)
treedb0f244fc413feeb2ae2fd34d0c2eea4939ed169 /Mk/Uses/kmod.mk
parentAdd missing patch files. (diff)
Fix check-plist of USES=kmod
No longer depend on (KERN_)DEBUGDIR being non-empty to decide whether to create the empty KERN_DEBUGDIR/KMODDIR directory, instead use a new argument 'debug' to indicate this. Add KERN_DEBUGDIR to PLIST_SUB and MAKE_ENV so that the including ports can use them. Ports using kmod:debug do need to add @dir entries to their pkg-plist for now to prevent 'make check-plist' errors, for example for default KMODDDIR: @dir /%%KERN_DEBUGDIR%%/%%KMODDIR%% @dir /%%KERN_DEBUGDIR%%/boot @dir /%%KERN_DEBUGDIR%% It would indeed be nice to automate this. PR: 216879 Submitted by: Sergey Kozlov (kozlov.sergey.404@gmail.com)
Notes
Notes: svn path=/head/; revision=433968
Diffstat (limited to 'Mk/Uses/kmod.mk')
-rw-r--r--Mk/Uses/kmod.mk24
1 files changed, 16 insertions, 8 deletions
diff --git a/Mk/Uses/kmod.mk b/Mk/Uses/kmod.mk
index a7c56f3c5766..e0afbb66f01a 100644
--- a/Mk/Uses/kmod.mk
+++ b/Mk/Uses/kmod.mk
@@ -4,7 +4,7 @@
#
# Feature: kmod
# Usage: USES=kmod
-# Valid ARGS: none
+# Valid ARGS: (none) debug
#
# MAINTAINER: rene@FreeBSD.org
@@ -13,8 +13,12 @@ _INCLUDE_USES_KMOD_MK= yes
_USES_POST+= kmod
-.if !empty(kmod_ARGS)
-IGNORE= USES=kmod takes no arguments
+.if empty(kmod_ARGS)
+_DEBUG_KMOD=
+.elif ${kmod_ARGS} == "debug"
+_DEBUG_KMOD= yes
+.else
+IGNORE= USES=kmod takes either no arguments or 'debug'
.endif
.if !exists(${SRC_BASE}/sys/Makefile)
@@ -34,21 +38,25 @@ MAKE_ENV+= KMODDIR="${KMODDIR}" SYSDIR="${SRC_BASE}/sys" NO_XREF=yes
PLIST_FILES+= "@kld ${KMODDIR}"
STRIP_CMD+= --strip-debug # do not strip kernel symbols
+.if !empty(_DEBUG_KMOD)
KERN_DEBUGDIR?= ${DEBUGDIR}
+PLIST_SUB+= KERN_DEBUGDIR="${KERN_DEBUGDIR:C,^/,,}"
+MAKE_ENV+= KERN_DEBUGDIR="${KERN_DEBUGDIR}"
+#XXX (rene): it would be nice to automatically add @dir entries here,
+# they are somehow needed according to 'make makeplist'
+.endif
+
.endif
.if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_KMOD_POST_MK)
_INCLUDE_USES_KMOD_POST_MK= yes
_USES_install+= 290:${STAGEDIR}${KMODDIR}
-.if !empty(KERN_DEBUGDIR)
-_USES_install+= 291:${STAGEDIR}${KERN_DEBUGDIR}${KMODDIR}
-.endif
-
${STAGEDIR}${KMODDIR}:
@${MKDIR} ${.TARGET}
-.if !empty(KERN_DEBUGDIR)
+.if !empty(_DEBUG_KMOD)
+_USES_install+= 291:${STAGEDIR}${KERN_DEBUGDIR}${KMODDIR}
${STAGEDIR}${KERN_DEBUGDIR}${KMODDIR}:
@${MKDIR} ${.TARGET}
.endif