]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - debian/rules
UBUNTU: Ubuntu-4.15.0-96.97
[mirror_ubuntu-bionic-kernel.git] / debian / rules
CommitLineData
0d34a427
LO
1#!/usr/bin/make -f
2#
3# $(DEBIAN)/rules for Ubuntu linux
4#
5# Use this however you want, just give credit where credit is due.
6#
7# Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
8#
9
10DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
11
12# dpkg-buildpackage passes options that are incomptatible
13# with the kernel build.
14unexport CFLAGS
15unexport LDFLAGS
16
17export LC_ALL=C
18export SHELL=/bin/bash -e
19
20# Where do we find the common configuration.
21export DROOT=debian
22
23# Common variables for all architectures
24include $(DROOT)/rules.d/0-common-vars.mk
25
26# Pull in some arch specific stuff
27-include $(DEBIAN)/rules.d/$(arch).mk
28
29# Pull in some branch specific stuff. Used by LTS backport
30# branches to override master branch settings such as do_tools_common.
31-include $(DEBIAN)/rules.d/hooks.mk
32
33# Maintainer targets
34include $(DROOT)/rules.d/1-maintainer.mk
35
88d5e264 36do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_bpftool) $(do_tools_x86)))
0d34a427 37do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
9b18b291 38do_tools_common?=true
f66a0ec7 39do_tools_host?=false
0938dca2 40do_tools_perf_jvmti?=false
0d34a427
LO
41
42# Don't build tools or udebs in a cross compile environment.
43ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
44 do_tools=false
45 disable_d_i=true
46 do_zfs=false
0d34a427
LO
47endif
48
b90b1fe0 49# Are any of the kernel signing options enabled.
44efa9e7 50any_signed=$(sort $(filter-out false,$(uefi_signed) $(fit_signed) $(opal_signed)))
b90b1fe0
AW
51ifeq ($(any_signed),true)
52bin_pkg_name=$(bin_pkg_name_unsigned)
53else
54bin_pkg_name=$(bin_pkg_name_signed)
55endif
56
0d34a427
LO
57# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
58ifeq ($(DEB_STAGE),stage1)
59 DEB_BUILD_PROFILES=stage1
60endif
61ifneq ($(DEB_BUILD_PROFILE),)
62 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
63endif
64ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
65 do_tools=false
66 do_doc_package=false
67 do_source_package=false
68 do_flavour_image_package=false
69 do_flavour_header_package=false
70endif
71
72# Being used to build a mainline build -- turn off things which do not work.
73ifeq ($(do_mainline_build),true)
74 do_extras_package=false
75 do_tools=false
76 no_dumpfile=1
77 do_zfs=false
0fa05ca6
AW
78 skipabi=true
79 skipmodule=true
80 skipretpoline=true
0d34a427
LO
81endif
82
83# Disable tools build and packaging if do_tools != true
84ifneq ($(do_tools),true)
85 do_linux_tools=
86 do_cloud_tools=
87 do_tools_common=
f66a0ec7 88 do_tools_host=
0d34a427
LO
89endif
90
f13b795d
AW
91ifeq ($(do_zfs),false)
92 do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore)
93endif
94
0d34a427
LO
95# Either tools package needs the common source preparation
96do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
97
98# autopkgtest -- rebuild support
99# only build the first flavour on the assumption it is representative
2c21160b 100ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
0d34a427 101flavours := $(firstword $(flavours))
2c21160b 102disable_d_i=true
0d34a427
LO
103endif
104
997b8c41 105# Versions of dkms packages.
8f75472f
AR
106dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
107dkms_spl_linux_version=$(shell gawk '/^spl-linux / { print $$2; }' debian/dkms-versions)
3ea873e5
AM
108dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390/ { print $$2; }' debian/dkms-versions)
109dkms_nvidia_435_version=$(shell gawk '/^nvidia-graphics-drivers-435/ { print $$2; }' debian/dkms-versions)
110dkms_nvidia_440_version=$(shell gawk '/^nvidia-graphics-drivers-440/ { print $$2; }' debian/dkms-versions)
997b8c41 111
0d34a427
LO
112# Debian Build System targets
113binary: binary-indep binary-arch
114
115build: build-arch build-indep
116
117clean: debian/control
118 dh_testdir
119 dh_testroot
120 dh_clean
121
122 # d-i stuff
123 rm -rf $(DEBIAN)/d-i-$(arch)
124 # Generated on the fly.
125 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
126
127 # normal build junk
128 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
129 rm -rf $(builddir)
130 rm -f $(stampdir)/stamp-*
131 rm -rf $(DEBIAN)/linux-*
132
133 # This gets rid of the d-i packages in control
134 cp -f $(DEBIAN)/control.stub $(DROOT)/control
135 cp $(DEBIAN)/changelog debian/changelog
136
137 # Install the copyright information.
138 cp $(DEBIAN)/copyright debian/copyright
139
527d1e11
AW
140 # Install the retpoline extractor.
141 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
142
0d34a427
LO
143 # If we have a reconstruct script use it.
144 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct
145
146 # Remove generated intermediate files
147 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
27170546 148 rm -f $(DROOT)/scripts/fix-filenames
0d34a427
LO
149
150distclean: clean
151 rm -rf $(DROOT)/control debian/changelog \
527d1e11
AW
152 debian/control debian/control.stub debian/copyright \
153 scripts/ubuntu-retpoline-extract-one
0d34a427
LO
154
155# Builds the image, arch headers and debug packages
156include $(DROOT)/rules.d/2-binary-arch.mk
157
158# Rules for building the udebs ($(DEBIAN)-installer)
159include $(DROOT)/rules.d/5-udebs.mk
160
161# Builds the source, doc and linux-headers indep packages
162include $(DROOT)/rules.d/3-binary-indep.mk
163
164# Various checks to be performed on builds
165include $(DROOT)/rules.d/4-checks.mk
166
167# Misc stuff
168.PHONY: $(DEBIAN)/control.stub
169$(DEBIAN)/control.stub: \
170 $(DROOT)/scripts/control-create \
171 $(DEBIAN)/control.stub.in \
172 $(DEBIAN)/changelog \
173 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
174 for i in $(DEBIAN)/control.stub.in; do \
175 new=`echo $$i | sed 's/\.in$$//'`; \
176 cat $$i | sed -e 's/PKGVER/$(release)/g' \
177 -e 's/ABINUM/$(abinum)/g' \
178 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
179 -e 's/=HUMAN=/$(human_arch)/g' \
180 > $$new; \
181 done
182 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
183 for i in $$flavours; do \
b90b1fe0 184 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
0d34a427
LO
185 sed -e 's/PKGVER/$(release)/g' \
186 -e 's/ABINUM/$(abinum)/g' \
187 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
188 -e 's/=HUMAN=/$(human_arch)/g' \
189 >> $(DEBIAN)/control.stub; \
190 done
191
192.PHONY: debian/control
193debian/control: $(DEBIAN)/control.stub
194 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
195 cp $(DEBIAN)/control.stub debian/control
196 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
197 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
198 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
199 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
200 >>$(CURDIR)/debian/control