git: 8c0c5bdf9d5e - main - Introduce MODULES_EXCLUDE

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Thu, 13 Jan 2022 14:16:56 UTC
The branch main has been updated by manu:

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

commit 8c0c5bdf9d5ebe08bb239633c16a567eb8a9f898
Author:     Emmanuel Vadot <manu@FreeBSD.org>
AuthorDate: 2021-11-06 09:11:58 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2022-01-13 14:16:34 +0000

    Introduce MODULES_EXCLUDE
    
    It's sometimes easier to exclude some modules rather than listing all
    possibly needed ones with MODULES_OVERRIDE.
    So for this add MODULES_EXCLUDE which do exactly as one would guess, excludes
    some modules from the build/install.
    
    For example if one wants to exclude all modules which are only present in the
    GENERIC config on amd64 :
    export MODULES_EXCLUDE=$(grep -E '^device' sys/amd64/conf/GENERIC | awk '{print $2}' | tr '\n' ' ')
    
    MFC after:      2 weeks
    Sponsored by:   Beckhoff Automation GmbH & Co. KG
    Differential Revision:  https://reviews.freebsd.org/D33443
---
 share/man/man5/make.conf.5 | 5 ++++-
 share/mk/bsd.kmod.mk       | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/share/man/man5/make.conf.5 b/share/man/man5/make.conf.5
index b3623b29a950..fd0837ecc121 100644
--- a/share/man/man5/make.conf.5
+++ b/share/man/man5/make.conf.5
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2021
+.Dd January 13, 2021
 .Dt MAKE.CONF 5
 .Os
 .Sh NAME
@@ -272,6 +272,9 @@ It defaults to
 .It Va MODULES_OVERRIDE
 .Pq Vt str
 Set to a list of modules to build instead of all of them.
+.It Va MODULES_EXCLUDE
+.Pq Vt str
+Set to a list of modules to exclude from the build.
 .It Va NO_KERNELCLEAN
 .Pq Vt bool
 Set this to skip running
diff --git a/share/mk/bsd.kmod.mk b/share/mk/bsd.kmod.mk
index 683967749e75..2287f447c704 100644
--- a/share/mk/bsd.kmod.mk
+++ b/share/mk/bsd.kmod.mk
@@ -1,4 +1,10 @@
 # $FreeBSD$
 
+.if defined(MODULES_EXCLUDE) && defined(KMOD) && ${MODULES_EXCLUDE:M${KMOD}}
+all:
+install:
+cleandir:
+.else
 .include <bsd.sysdir.mk>
 .include "${SYSDIR}/conf/kmod.mk"
+.endif