From 3f0b112d3c6b53e15a963aa29f36cc0fb2a855fc Mon Sep 17 00:00:00 2001
From: emax <emax@FreeBSD.org>
Date: Wed, 28 Jan 2004 00:42:51 +0000
Subject: [PATCH] Add NO_BLUETOOTH knob to the build process

Requested by:	phk
Reviewed by:	imp (mentor), ru
---
 include/Makefile              | 2 ++
 lib/Makefile                  | 6 ++++--
 share/examples/etc/make.conf  | 1 +
 sys/modules/netgraph/Makefile | 2 ++
 usr.bin/Makefile              | 2 ++
 usr.sbin/Makefile             | 2 ++
 6 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/include/Makefile b/include/Makefile
index ea5767607a9b..c9168b14e671 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -40,7 +40,9 @@ LSUBDIRS=	cam/scsi dev/an dev/bktr dev/firewire dev/ic dev/iicbus \
 	security/mac_lomac security/mac_mls security/mac_partition \
 	ufs/ffs ufs/ufs
 
+.if !defined(NO_BLUETOOTH)
 LSUBSUBDIRS=	netgraph/bluetooth/include
+.endif
 
 # Define SHARED to indicate whether you want symbolic links to the system
 # source (``symlinks''), or a separate copy (``copies'').  ``symlinks'' is
diff --git a/lib/Makefile b/lib/Makefile
index 7dbe28daceb9..5b4e020caada 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -70,10 +70,12 @@ _libusbhid=	libusbhid
 .endif
 
 .if ${MACHINE_ARCH} == "i386"
-_compat=	compat
+.if !defined(NO_BLUETOOTH)
 _libbluetooth=	libbluetooth
-_libncp=	libncp
 _libsdp=	libsdp
+.endif
+_compat=	compat
+_libncp=	libncp
 _libsmb=	libsmb
 _libvgl=	libvgl
 .endif
diff --git a/share/examples/etc/make.conf b/share/examples/etc/make.conf
index 8236ecf78d0e..f79459f9b48a 100644
--- a/share/examples/etc/make.conf
+++ b/share/examples/etc/make.conf
@@ -103,6 +103,7 @@
 #NO_CVS=	true	# do not build CVS
 #NO_CXX=	true	# do not build C++ and friends
 #NO_BIND=	true	# do not build BIND
+#NO_BLUETOOTH=	true	# do not build Bluetooth related stuff
 #NO_FORTRAN=	true	# do not build g77 and related libraries
 #NO_GDB=	true	# do not build GDB
 #NO_I4B=	true	# do not build isdn4bsd package
diff --git a/sys/modules/netgraph/Makefile b/sys/modules/netgraph/Makefile
index 12dbe0dcd909..6dba941f6c40 100644
--- a/sys/modules/netgraph/Makefile
+++ b/sys/modules/netgraph/Makefile
@@ -43,7 +43,9 @@ _mppc=		mppc
 
 .if ${MACHINE_ARCH} == "i386"
 # Things that don't compile on alpha or are aout specific:
+.if !defined(NO_BLUETOOTH) || defined(ALL_MODULES)
 _bluetooth=	bluetooth
 .endif
+.endif
 
 .include <bsd.subdir.mk>
diff --git a/usr.bin/Makefile b/usr.bin/Makefile
index 1d2e3cc45ff1..54df03d0a0c8 100644
--- a/usr.bin/Makefile
+++ b/usr.bin/Makefile
@@ -264,7 +264,9 @@ _usbhidctl=	usbhidctl
 .endif
 
 .if ${MACHINE_ARCH} == "i386"
+.if !defined(NO_BLUETOOTH)
 _bluetooth=	bluetooth
+.endif
 _doscmd=	doscmd
 _ncplist=	ncplist
 _ncplogin=	ncplogin
diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile
index e9a1f437f6ad..3962b4d4f6d4 100644
--- a/usr.sbin/Makefile
+++ b/usr.sbin/Makefile
@@ -243,7 +243,9 @@ _acpi=		acpi
 _apm=		apm
 _apmd=		apmd
 _asf=		asf
+.if !defined(NO_BLUETOOTH)
 _bluetooth=	bluetooth
+.endif
 .if ${MACHINE} == "i386"
 _boot0cfg=	boot0cfg
 .endif