git: d4af9eb430ce - stable/13 - modules: Only build MAC modules if options MAC is set

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Thu, 23 Jun 2022 22:23:05 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=d4af9eb430ceb48e74027193534b33c86ccda2cc

commit d4af9eb430ceb48e74027193534b33c86ccda2cc
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-06-14 16:07:30 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-06-23 22:22:18 +0000

    modules: Only build MAC modules if options MAC is set
    
    They are not loadable otherwise.
    
    Reviewed by:    emaste
    MFC after:      1 week
    Sponsored by:   Juniper Networks, Inc.
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D35369
    
    (cherry picked from commit 648a47b85476ed0f8e3c61800b134bd3bb6001ee)
---
 sys/modules/Makefile | 44 +++++++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 13 deletions(-)

diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 9b5474425916..a8dffd45cb4f 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -222,19 +222,19 @@ SUBDIR=	\
 	linuxkpi_wlan \
 	${_lio} \
 	lpt \
-	mac_biba \
-	mac_bsdextended \
-	mac_ifoff \
-	mac_lomac \
-	mac_mls \
-	mac_none \
-	mac_ntpd \
-	mac_partition \
-	mac_portacl \
-	mac_priority \
-	mac_seeotheruids \
-	mac_stub \
-	mac_test \
+	${_mac_biba} \
+	${_mac_bsdextended} \
+	${_mac_ifoff} \
+	${_mac_lomac} \
+	${_mac_mls} \
+	${_mac_none} \
+	${_mac_ntpd} \
+	${_mac_partition} \
+	${_mac_portacl} \
+	${_mac_priority} \
+	${_mac_seeotheruids} \
+	${_mac_stub} \
+	${_mac_test} \
 	${_malo} \
 	md \
 	mdio \
@@ -551,6 +551,24 @@ _rtw88fw=	rtw88fw
 _vmware=	vmware
 .endif
 
+# MAC framework
+.if ${KERN_OPTS:MMAC} || defined(ALL_MODULES)
+_mac_biba=	mac_biba
+_mac_bsdextended= mac_bsdextended
+_mac_ifoff=	mac_ifoff
+_mac_lomac=	mac_lomac
+_mac_mls=	mac_mls
+_mac_none=	mac_none
+_mac_ntpd=	mac_ntpd
+_mac_partition=	mac_partition
+_mac_pimd=	mac_pimd
+_mac_portacl=	mac_portacl
+_mac_priority=	mac_priority
+_mac_seeotheruids= mac_seeotheruids
+_mac_stub=	mac_stub
+_mac_test=	mac_test
+.endif
+
 .if ${MK_NETGRAPH} != "no" || defined(ALL_MODULES)
 _netgraph=	netgraph
 .endif