git: 648a47b85476 - main - modules: Only build MAC modules if options MAC is set

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Tue, 14 Jun 2022 16:10:29 UTC
The branch main has been updated by mhorne:

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

commit 648a47b85476ed0f8e3c61800b134bd3bb6001ee
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2022-06-14 16:07:30 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2022-06-14 16:10:08 +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
---
 sys/modules/Makefile | 46 ++++++++++++++++++++++++++++++++--------------
 1 file changed, 32 insertions(+), 14 deletions(-)

diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 29a77e07399e..6917074ea5c8 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -216,20 +216,20 @@ SUBDIR=	\
 	linuxkpi_wlan \
 	${_lio} \
 	lpt \
-	mac_biba \
-	mac_bsdextended \
-	mac_ifoff \
-	mac_lomac \
-	mac_mls \
-	mac_none \
-	mac_ntpd \
-	mac_partition \
-	mac_pimd \
-	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_pimd} \
+	${_mac_portacl} \
+	${_mac_priority} \
+	${_mac_seeotheruids} \
+	${_mac_stub} \
+	${_mac_test} \
 	${_malo} \
 	${_mana} \
 	md \
@@ -541,6 +541,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