]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - debian/rules
scsi: bfa: Replace snprintf() with sysfs_emit()
[mirror_ubuntu-focal-kernel.git] / debian / rules
CommitLineData
c74bfc18
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
36do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_bpftool) $(do_tools_x86)))
37do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
38do_tools_common?=true
39do_tools_host?=false
40do_tools_perf_jvmti?=false
f711f2c1 41do_enforce_all?=false
c74bfc18
LO
42
43# Don't build tools or udebs in a cross compile environment.
44ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
45 do_tools=false
46 disable_d_i=true
47 do_zfs=false
48 do_dkms_nvidia=false
04dad124 49 do_dkms_nvidia_server=false
c74bfc18 50 do_dkms_vbox=false
aef9c3f8 51 do_dkms_wireguard=false
c74bfc18
LO
52endif
53
54# Are any of the kernel signing options enabled.
55any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed) $(sipl_signed)))
56ifeq ($(any_signed),true)
57bin_pkg_name=$(bin_pkg_name_unsigned)
58else
59bin_pkg_name=$(bin_pkg_name_signed)
60endif
61
62# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
63ifeq ($(DEB_STAGE),stage1)
64 DEB_BUILD_PROFILES=stage1
65endif
66ifneq ($(DEB_BUILD_PROFILE),)
67 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
68endif
69ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
70 do_tools=false
71 do_doc_package=false
72 do_source_package=false
73 do_flavour_image_package=false
74 do_flavour_header_package=false
75endif
76
77# autopkgtest -- rebuild support
78# - only build the first flavour on the assumption it is representative
79# - disable dkms builds as the versions used may have been deleted
80ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
81 flavours := $(firstword $(flavours))
82 disable_d_i=true
83 do_zfs=false
84 do_dkms_nvidia=false
04dad124 85 do_dkms_nvidia_server=false
c74bfc18
LO
86 do_dkms_vbox=false
87endif
88
89# Being used to build a mainline build -- turn off things which do not work.
90ifeq ($(do_mainline_build),true)
91 do_extras_package=false
92 do_tools=false
93 no_dumpfile=1
94 do_zfs=false
95 do_dkms_nvidia=false
04dad124 96 do_dkms_nvidia_server=false
c74bfc18
LO
97 do_dkms_vbox=false
98 skipabi=true
99 skipmodule=true
100 skipretpoline=true
101endif
102
103# Disable tools build and packaging if do_tools != true
104ifneq ($(do_tools),true)
105 do_linux_tools=
106 do_cloud_tools=
107 do_tools_common=
108 do_tools_host=
109endif
110
111ifeq ($(do_zfs),false)
84a1d9e8 112 do_zfs_disable:=$(shell for m in $$(cat $(DROOT)/zfs-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done)
c74bfc18
LO
113endif
114
115ifeq ($(do_dkms_vbox),false)
84a1d9e8 116 do_vbox_disable:=$(shell for m in $$(cat $(DROOT)/vbox-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done)
c74bfc18
LO
117endif
118
774d43ed 119ifeq ($(do_dkms_wireguard),false)
84a1d9e8 120 do_wireguard_disable:=$(shell for m in $$(cat $(DROOT)/wireguard-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done)
774d43ed
PP
121endif
122
c74bfc18
LO
123# Either tools package needs the common source preparation
124do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
125
126# Versions of dkms packages.
127dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
c74bfc18 128dkms_vbox_guest_version=$(shell gawk '/^virtualbox/ { print $$2; }' debian/dkms-versions)
aef9c3f8 129dkms_wireguard_version=$(shell gawk '/^wireguard-linux-compat / { print $$2; }' debian/dkms-versions)
c74bfc18 130
6d4ba6a4
AW
131# NVIDIA DKMS package gross series split into desktop and server.
132nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions)
133nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
134
c74bfc18
LO
135# Debian Build System targets
136binary: binary-indep binary-arch
137
138build: build-arch build-indep
139
de2c927b 140clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.pem
c74bfc18
LO
141 dh_testdir
142 dh_testroot
143 dh_clean
144
145 # d-i stuff
146 rm -rf $(DEBIAN)/d-i-$(arch)
147 # Generated on the fly.
148 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
149
150 # normal build junk
151 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
152 rm -rf $(builddir)
153 rm -f $(stampdir)/stamp-*
154 rm -rf $(DEBIAN)/linux-*
155
156 # This gets rid of the d-i packages in control
157 cp -f $(DEBIAN)/control.stub $(DROOT)/control
158 cp $(DEBIAN)/changelog debian/changelog
159
160 # Install the copyright information.
161 cp $(DEBIAN)/copyright debian/copyright
162
163 # Install the retpoline extractor.
164 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
165
166 # If we have a reconstruct script use it.
167 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct || true
168
169 # Remove generated intermediate files
170 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
171 rm -f $(DROOT)/scripts/fix-filenames
172
173distclean: clean
174 rm -rf $(DROOT)/control debian/changelog \
175 debian/control debian/control.stub debian/copyright \
176 scripts/ubuntu-retpoline-extract-one
177
178# Builds the image, arch headers and debug packages
179include $(DROOT)/rules.d/2-binary-arch.mk
180
181# Rules for building the udebs ($(DEBIAN)-installer)
182include $(DROOT)/rules.d/5-udebs.mk
183
184# Builds the source, doc and linux-headers indep packages
185include $(DROOT)/rules.d/3-binary-indep.mk
186
187# Various checks to be performed on builds
188include $(DROOT)/rules.d/4-checks.mk
189
19120635
SF
190control_files := $(DEBIAN)/control.stub.in
191ifeq ($(do_libc_dev_package),true)
02d8fa27
SF
192ifneq (,$(wildcard $(DEBIAN)/control.d/linux-libc-dev.stub))
193 control_files += $(DEBIAN)/control.d/linux-libc-dev.stub
194endif
19120635 195endif
49270d4f 196ifeq ($(do_doc_package),true)
02d8fa27
SF
197ifneq (,$(wildcard $(DEBIAN)/control.d/linux-doc.stub))
198 control_files += $(DEBIAN)/control.d/linux-doc.stub
199endif
49270d4f 200endif
19120635 201
c74bfc18
LO
202# Misc stuff
203.PHONY: $(DEBIAN)/control.stub
204$(DEBIAN)/control.stub: \
205 $(DROOT)/scripts/control-create \
19120635 206 $(control_files) \
c74bfc18
LO
207 $(DEBIAN)/changelog \
208 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
19120635
SF
209 for i in $(control_files); do \
210 cat $$i; \
211 echo ""; \
212 done | sed -e 's/PKGVER/$(release)/g' \
c74bfc18
LO
213 -e 's/ABINUM/$(abinum)/g' \
214 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
215 -e 's/=HUMAN=/$(human_arch)/g' \
216 -e 's/=SERIES=/$(series)/g' \
19120635 217 > $(DEBIAN)/control.stub;
c74bfc18
LO
218 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
219 for i in $$flavours; do \
220 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
221 sed -e 's/PKGVER/$(release)/g' \
222 -e 's/ABINUM/$(abinum)/g' \
223 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
224 -e 's/=HUMAN=/$(human_arch)/g' \
225 -e 's/=SERIES=/$(series)/g' \
226 >> $(DEBIAN)/control.stub; \
227 done
228
229.PHONY: debian/control
230debian/control: $(DEBIAN)/control.stub
231 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
232 cp $(DEBIAN)/control.stub debian/control
233 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
234 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
235 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
236 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
237 >>$(CURDIR)/debian/control
322b3ffe
AW
238
239debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DROOT)/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
240 for cert in $(sort $(notdir $^)); \
241 do \
242 for dir in $(DEBIAN) $(DROOT); \
243 do \
244 if [ -f "$$dir/certs/$$cert" ]; then \
245 cat "$$dir/certs/$$cert"; \
246 break; \
247 fi; \
248 done; \
249 done >"$@"
de2c927b
DJL
250
251debian/canonical-revoked-certs.pem: $(wildcard $(DROOT)/revoked-certs/*-all.pem) $(wildcard $(DROOT)/revoked-certs/*-$(arch).pem) $(wildcard $(DEBIAN)/revoked-certs/*-all.pem) $(wildcard $(DEBIAN)/revoked-certs/*-$(arch).pem)
252 for cert in $(sort $(notdir $^)); \
253 do \
254 for dir in $(DEBIAN) $(DROOT); \
255 do \
256 if [ -f "$$dir/revoked-certs/$$cert" ]; then \
257 cat "$$dir/revoked-certs/$$cert"; \
258 break; \
259 fi; \
260 done; \
261 done >"$@"