diff --git a/debian.master/control.stub.in b/debian.master/control.stub.in
index f95852a48363..088bc785e280 100644
--- a/debian.master/control.stub.in
+++ b/debian.master/control.stub.in
@@ -103,19 +103,6 @@ Description: Header files related to Linux kernel version PKGVER
  that want the latest kernel headers. Please read
  /usr/share/doc/SRCPKGNAME-headers-PKGVER-ABINUM/debian.README.gz for details
 
-Package: linux-libc-dev
-Architecture: amd64 armhf arm64 i386 ppc64el s390x
-Depends: ${misc:Depends}
-Conflicts: SRCPKGNAME-kernel-headers
-Replaces: SRCPKGNAME-kernel-headers
-Provides: SRCPKGNAME-kernel-headers, aufs-dev
-Multi-Arch: same
-Description: Linux Kernel Headers for development
- This package provides headers from the Linux kernel.  These headers
- are used by the installed headers for GNU glibc and other system
- libraries. They are NOT meant to be used to build third-party modules for
- your kernel. Use SRCPKGNAME-headers-* packages for that.
-
 Package: SRCPKGNAME-tools-common
 Build-Profiles: <!stage1>
 Architecture: all
diff --git a/debian/control.d/linux-libc-dev.stub b/debian/control.d/linux-libc-dev.stub
new file mode 100644
index 000000000000..47ef2e1b521c
--- /dev/null
+++ b/debian/control.d/linux-libc-dev.stub
@@ -0,0 +1,12 @@
+Package: linux-libc-dev
+Architecture: amd64 armhf arm64 i386 ppc64el s390x
+Depends: ${misc:Depends}
+Conflicts: linux-kernel-headers
+Replaces: linux-kernel-headers
+Provides: linux-kernel-headers, aufs-dev
+Multi-Arch: same
+Description: Linux Kernel Headers for development
+ This package provides headers from the Linux kernel.  These headers
+ are used by the installed headers for GNU glibc and other system
+ libraries. They are NOT meant to be used to build third-party modules for
+ your kernel. Use SRCPKGNAME-headers-* packages for that.
diff --git a/debian/rules b/debian/rules
index 78ffcfc8c273..47cbe03de04f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -175,22 +175,27 @@ include $(DROOT)/rules.d/3-binary-indep.mk
 # Various checks to be performed on builds
 include $(DROOT)/rules.d/4-checks.mk
 
+control_files := $(DEBIAN)/control.stub.in
+ifeq ($(do_libc_dev_package),true)
+	control_files += $(DROOT)/control.d/linux-libc-dev.stub
+endif
+
 # Misc stuff
 .PHONY: $(DEBIAN)/control.stub
 $(DEBIAN)/control.stub: 				\
 		$(DROOT)/scripts/control-create		\
-		$(DEBIAN)/control.stub.in			\
+		$(control_files)			\
 		$(DEBIAN)/changelog			\
 		$(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
-	for i in $(DEBIAN)/control.stub.in; do					\
-	  new=`echo $$i | sed 's/\.in$$//'`;					\
-	  cat $$i | sed -e 's/PKGVER/$(release)/g'                              \
+	for i in $(control_files); do                                           \
+	  cat $$i;                                                              \
+	  echo "";                                                              \
+	done | sed -e 's/PKGVER/$(release)/g'                                   \
 	        -e 's/ABINUM/$(abinum)/g'                                       \
 		-e 's/SRCPKGNAME/$(src_pkg_name)/g'                             \
 		-e 's/=HUMAN=/$(human_arch)/g'                                  \
 		-e 's/=SERIES=/$(series)/g'                                     \
-	  > $$new;								\
-	done
+	  > $(DEBIAN)/control.stub;
 	flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
 	for i in $$flavours; do							\
 	  $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" |	\
diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
index a5035def11d6..37574fbbdfde 100644
--- a/debian/rules.d/0-common-vars.mk
+++ b/debian/rules.d/0-common-vars.mk
@@ -169,8 +169,13 @@ ifeq ($(full_build),false)
 do_source_package_content=false
 endif
 
-# linux-libc-dev may not be needed, default to building it.
+# linux-libc-dev may not be needed, default to building it only for the
+# primary variant
+ifneq ($(filter --,$(variants)),)
 do_libc_dev_package=true
+else
+do_libc_dev_package=false
+endif
 
 # common headers normally is built as an indep package, but may be arch
 do_common_headers_indep=true
