/usr/src/linux-source-4.4.0/debian/rules is in linux-source-4.4.0 4.4.0-79.100.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | #!/usr/bin/make -f
#
# $(DEBIAN)/rules for Ubuntu linux
#
# Use this however you want, just give credit where credit is due.
#
# Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
#
DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
# dpkg-buildpackage passes options that are incomptatible
# with the kernel build.
unexport CFLAGS
unexport LDFLAGS
export LC_ALL=C
export SHELL=/bin/bash -e
# Where do we find the common configuration.
export DROOT=debian
# Common variables for all architectures
include $(DROOT)/rules.d/0-common-vars.mk
# Pull in some arch specific stuff
-include $(DEBIAN)/rules.d/$(arch).mk
# Pull in some branch specific stuff. Used by LTS backport
# branches to override master branch settings such as do_tools_common.
-include $(DEBIAN)/rules.d/hooks.mk
# Maintainer targets
include $(DROOT)/rules.d/1-maintainer.mk
do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_x86)))
do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
do_tools_common=true
# Don't build tools or udebs in a cross compile environment.
ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
do_tools=false
disable_d_i=true
do_zfs=false
do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore)
endif
# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
ifeq ($(DEB_STAGE),stage1)
DEB_BUILD_PROFILES=stage1
endif
ifneq ($(DEB_BUILD_PROFILE),)
DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
endif
ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
do_tools=false
do_doc_package=false
do_source_package=false
do_flavour_image_package=false
do_flavour_header_package=false
endif
# Being used to build a mainline build -- turn off things which do not work.
ifeq ($(do_mainline_build),true)
do_extras_package=false
do_tools=false
no_dumpfile=1
do_zfs=false
endif
# Disable tools build and packaging if do_tools != true
ifneq ($(do_tools),true)
do_linux_tools=
do_cloud_tools=
do_tools_common=
endif
# Either tools package needs the common source preparation
do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
# autopkgtest -- rebuild support
# only build the first flavour on the assumption it is representative
ifeq ($(DEB_BUILD_PROFILE),autopkgtest)
flavours := $(firstword $(flavours))
endif
# Debian Build System targets
binary: binary-indep binary-arch
build: build-arch build-indep
clean: debian/control
dh_testdir
dh_testroot
dh_clean
# d-i stuff
rm -rf $(DEBIAN)/d-i-$(arch)
# Generated on the fly.
rm -f $(DEBIAN)/d-i/firmware/kernel-image
# normal build junk
rm -rf $(DEBIAN)/abi/$(release)-$(revision)
rm -rf $(builddir)
rm -f $(stampdir)/stamp-*
rm -rf $(DEBIAN)/linux-*
# This gets rid of the d-i packages in control
cp -f $(DEBIAN)/control.stub $(DROOT)/control
cp $(DEBIAN)/changelog debian/changelog
# Install the copyright information.
cp $(DEBIAN)/copyright debian/copyright
# If we have a reconstruct script use it.
[ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct
# Remove generated intermediate files
rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub \
$(DEBIAN)/d-i/kernel-versions
distclean: clean
rm -rf $(DROOT)/control debian/changelog \
debian/control debian/control.stub debian/copyright
# Builds the image, arch headers and debug packages
include $(DROOT)/rules.d/2-binary-arch.mk
# Rules for building the udebs ($(DEBIAN)-installer)
include $(DROOT)/rules.d/5-udebs.mk
# Builds the source, doc and linux-headers indep packages
include $(DROOT)/rules.d/3-binary-indep.mk
# Various checks to be performed on builds
include $(DROOT)/rules.d/4-checks.mk
# Misc stuff
.PHONY: $(DEBIAN)/control.stub
$(DEBIAN)/control.stub: $(DEBIAN)/d-i/kernel-versions.in \
$(DROOT)/scripts/control-create \
$(DEBIAN)/control.stub.in \
$(DEBIAN)/changelog \
$(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
for i in $(DEBIAN)/d-i/kernel-versions.in $(DEBIAN)/control.stub.in; do \
new=`echo $$i | sed 's/\.in$$//'`; \
cat $$i | sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
-e 's/=HUMAN=/$(human_arch)/g' \
> $$new; \
done
flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
for i in $$flavours; do \
$(SHELL) $(DROOT)/scripts/control-create $$i | \
sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
-e 's/=HUMAN=/$(human_arch)/g' \
>> $(DEBIAN)/control.stub; \
done
.PHONY: debian/control
debian/control: $(DEBIAN)/control.stub
rm -rf $(builddir)/modules $(builddir)/firmware \
$(builddir)/kernel-versions $(builddir)/package-list \
$(builddir)/$(DEBIAN)
mkdir -p $(builddir)/modules/$(arch)/
cp $(DEBIAN)/d-i/modules/* $(builddir)/modules/$(arch)/
mkdir -p $(builddir)/firmware/$(arch)/
cp $(DEBIAN)/d-i/firmware/* $(builddir)/firmware/$(arch)/
cp $(DEBIAN)/d-i/package-list $(DEBIAN)/d-i/kernel-versions $(builddir)/
touch $(builddir)/modules/$(arch)/kernel-image
# kernel-wedge needs to poke around in $(DEBIAN)/
ln -nsf $(CURDIR)/debian $(builddir)/debian
# Some files may need to differ between architectures
if [ -d $(DEBIAN)/d-i/modules-$(arch) ]; then \
cp $(DEBIAN)/d-i/modules-$(arch)/* \
$(builddir)/modules/$(arch)/; \
fi
if [ -d $(DEBIAN)/d-i/firmware-$(arch) ]; then \
cp $(DEBIAN)/d-i/firmware-$(arch)/* \
$(builddir)/firmware/$(arch)/; \
fi
# Remove unwanted stuff for this architecture
if [ -r "$(DEBIAN)/d-i/exclude-modules.$(arch)" ]; then \
(cat $(DEBIAN)/d-i/exclude-modules.$(arch); \
ls $(builddir)/modules/$(arch)/) | sort | uniq -d | \
(cd $(builddir)/modules/$(arch)/; xargs rm -f); \
fi
if [ -r "$(DEBIAN)/d-i/exclude-firmware.$(arch)" ]; then \
(cat $(DEBIAN)/d-i/exclude-firmware.$(arch); \
ls $(builddir)/firmware/$(arch)/) | sort | uniq -d | \
(cd $(builddir)/firmware/$(arch)/; xargs rm -f); \
fi
# Per flavour module lists
flavour_modules=`ls $(DEBIAN)/d-i/modules.$(arch)-* 2>/dev/null` \
|| true; \
if [ "$$flavour_modules" != "" ]; then \
for flav in $$flavour_modules; do \
name=`echo $$flav | sed 's/.*\/modules.$(arch)-//'`; \
mkdir $(builddir)/modules/$(arch)-$$name; \
(cd $(builddir)/modules/; tar cf - `cat ../$$flav`) | \
(cd $(builddir)/modules/$(arch)-$$name/; tar xf -); \
touch $(builddir)/modules/$(arch)-$$name/kernel-image; \
done; \
fi
flavour_firmware=`ls $(DEBIAN)/d-i/firmware.$(arch)-* 2>/dev/null` \
|| true; \
if [ "$$flavour_firmware" != "" ]; then \
for flav in $$flavour_firmware; do \
name=`echo $$flav | sed 's/.*\/firmware.$(arch)-//'`; \
mkdir $(builddir)/firmware/$(arch)-$$name; \
(cd $(builddir)/firmware/; tar cf - `cat ../$$flav`) | \
(cd $(builddir)/firmware/$(arch)-$$name/; tar xf -);\
touch $(builddir)/firmware/$(arch)-$$name/kernel-image; \
done; \
fi
# Some files may need to differ between flavours
flavour_module_dirs=`ls -d $(DEBIAN)/d-i/modules-$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_module_dirs" ]; then \
for flav in $$flavour_module_dirs; do \
name=`echo $$flav | sed 's/.*\/modules-$(arch)-//'`; \
[ -d $(builddir)/modules/$(arch)-$$name ] || \
cp -a $(builddir)/modules/$(arch) \
modules/$(arch)-$$name; \
cp $$flav/* $(builddir)/modules/$(arch)-$$name/; \
done; \
fi
flavour_firmware_dirs=`ls -d $(DEBIAN)/d-i/firmware-$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_firmware_dirs" ]; then \
for flav in $$flavour_firmware_dirs; do \
name=`echo $$flav | sed 's/.*\/firmware-$(arch)-//'`; \
[ -d $(builddir)/firmware/$(arch)-$$name ] || \
cp -a $(builddir)/firmware/$(arch) \
firmware/$(arch)-$$name; \
cp $$flav/* $(builddir)/firmware/$(arch)-$$name/; \
done; \
fi
# Remove unwanted stuff for each flavour
flavour_exclude=`ls $(DEBIAN)/d-i/exclude-modules.$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_exclude" ]; then \
for flav in $$flavour_exclude; do \
name=`echo $$flav | sed 's/.*\/exclude-modules.$(arch)-//'`;\
[ -d $(builddir)/modules/$(arch)-$$name ] || \
cp -a $(builddir)/modules/$(arch) \
$(builddir)/modules/$(arch)-$$name; \
(cat $$flav; \
ls $(builddir)/modules/$(arch)-$$name) | \
sort | uniq -d | \
(cd $(builddir)/modules/$(arch)-$$name/; \
xargs rm -f); \
done; \
fi
flavour_exclude=`ls $(DEBIAN)/d-i/exclude-firmware.$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_exclude" ]; then \
for flav in $$flavour_exclude; do \
name=`echo $$flav | sed 's/.*\/exclude-firmware.$(arch)-//'`;\
[ -d $(builddir)/firmware/$(arch)-$$name ] || \
cp -a $(builddir)/firmware/$(arch) \
$(builddir)/firmware/$(arch)-$$name; \
(cat $$flav; \
ls $(builddir)/firmware/$(arch)-$$name) | \
sort | uniq -d | \
(cd $(builddir)/firmware/$(arch)-$$name/; \
xargs rm -f); \
done; \
fi
if [ ! -d $(builddir)/modules/$(build_arch) ]; then \
mkdir -p $(builddir)/modules/$(build_arch); \
cp $(builddir)/modules/$(arch)/* \
$(builddir)/modules/$(build_arch); \
fi
if [ ! -d $(builddir)/firmware/$(build_arch) ]; then \
mkdir -p $(builddir)/firmware/$(build_arch); \
cp $(builddir)/firmware/$(arch)/* \
$(builddir)/firmware/$(build_arch); \
fi
echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
cp $(DEBIAN)/control.stub debian/control
cd $(builddir) && LANG=C kernel-wedge gen-control >> $(CURDIR)/debian/control
|