]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - debian/rules
x86/speculation/mmio: Enable CPU Fill buffer clearing on idle
[mirror_ubuntu-jammy-kernel.git] / debian / rules
CommitLineData
29f98055
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
41do_enforce_all?=false
42
807e0ec0 43# Don't build tools in a cross compile environment.
29f98055
LO
44ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
45 do_tools=false
29f98055 46 do_zfs=false
29f98055
LO
47endif
48
49# Are any of the kernel signing options enabled.
50any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed) $(sipl_signed)))
51ifeq ($(any_signed),true)
52bin_pkg_name=$(bin_pkg_name_unsigned)
53else
54bin_pkg_name=$(bin_pkg_name_signed)
55endif
56
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# autopkgtest -- rebuild support
73# - only build the first flavour on the assumption it is representative
74# - disable dkms builds as the versions used may have been deleted
75ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
76 flavours := $(firstword $(flavours))
29f98055 77 do_zfs=false
b29295c9 78 do_v4l2loopback=false
29f98055
LO
79endif
80
81# Being used to build a mainline build -- turn off things which do not work.
82ifeq ($(do_mainline_build),true)
83 do_extras_package=false
84 do_tools=false
85 no_dumpfile=1
86 do_zfs=false
29f98055
LO
87 skipabi=true
88 skipmodule=true
89 skipretpoline=true
90endif
91
92# Disable tools build and packaging if do_tools != true
93ifneq ($(do_tools),true)
94 do_linux_tools=
95 do_cloud_tools=
96 do_tools_common=
97 do_tools_host=
98endif
99
100ifeq ($(do_zfs),false)
101 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)
102endif
103
b29295c9
YSY
104ifeq ($(do_v4l2loopback),false)
105 do_v4l2loopback_disable:=$(shell for m in $$(cat $(DROOT)/v4l2loopback-modules.ignore); do grep -qxF $$m $(prev_abidir)/../modules.ignore 2>/dev/null || echo $$m >> $(prev_abidir)/../modules.ignore; done)
106endif
107
29f98055
LO
108ifeq ($(do_dkms_wireguard),false)
109 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)
110endif
111
112# Either tools package needs the common source preparation
113do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
114
115# Versions of dkms packages.
116dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
b29295c9 117dkms_v4l2loopback_version=$(shell gawk '/^v4l2loopback / { print $$2; }' debian/dkms-versions)
29f98055
LO
118
119# NVIDIA DKMS package gross series split into desktop and server.
120nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*\) .*/\1/p' debian/dkms-versions)
121nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
122
123# Debian Build System targets
124binary: binary-indep binary-arch
125
126build: build-arch build-indep
127
8a151309 128clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.pem
29f98055
LO
129 dh_testdir
130 dh_testroot
131 dh_clean
132
29f98055
LO
133 # normal build junk
134 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
135 rm -rf $(builddir)
136 rm -f $(stampdir)/stamp-*
137 rm -rf $(DEBIAN)/linux-*
138
29f98055
LO
139 cp $(DEBIAN)/changelog debian/changelog
140
141 # Install the copyright information.
142 cp $(DEBIAN)/copyright debian/copyright
143
144 # Install the retpoline extractor.
145 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
146
147 # If we have a reconstruct script use it.
148 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct || true
149
150 # Remove generated intermediate files
151 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
152 rm -f $(DROOT)/scripts/fix-filenames
153
154distclean: clean
155 rm -rf $(DROOT)/control debian/changelog \
156 debian/control debian/control.stub debian/copyright \
157 scripts/ubuntu-retpoline-extract-one
158
159# Builds the image, arch headers and debug packages
160include $(DROOT)/rules.d/2-binary-arch.mk
161
29f98055
LO
162# Builds the source, doc and linux-headers indep packages
163include $(DROOT)/rules.d/3-binary-indep.mk
164
165# Various checks to be performed on builds
166include $(DROOT)/rules.d/4-checks.mk
167
168control_files := $(DEBIAN)/control.stub.in
169ifeq ($(do_libc_dev_package),true)
170ifneq (,$(wildcard $(DEBIAN)/control.d/linux-libc-dev.stub))
171 control_files += $(DEBIAN)/control.d/linux-libc-dev.stub
172endif
173endif
174ifeq ($(do_doc_package),true)
175ifneq (,$(wildcard $(DEBIAN)/control.d/linux-doc.stub))
176 control_files += $(DEBIAN)/control.d/linux-doc.stub
177endif
178endif
179
180# Misc stuff
181.PHONY: $(DEBIAN)/control.stub
182$(DEBIAN)/control.stub: \
183 $(DROOT)/scripts/control-create \
184 $(control_files) \
185 $(DEBIAN)/changelog \
186 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
187 for i in $(control_files); do \
188 cat $$i; \
189 echo ""; \
190 done | sed -e 's/PKGVER/$(release)/g' \
191 -e 's/ABINUM/$(abinum)/g' \
192 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
193 -e 's/=HUMAN=/$(human_arch)/g' \
194 -e 's/=SERIES=/$(series)/g' \
195 > $(DEBIAN)/control.stub;
196 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
197 for i in $$flavours; do \
198 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
199 sed -e 's/PKGVER/$(release)/g' \
200 -e 's/ABINUM/$(abinum)/g' \
201 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
202 -e 's/=HUMAN=/$(human_arch)/g' \
203 -e 's/=SERIES=/$(series)/g' \
204 >> $(DEBIAN)/control.stub; \
205 done
206
207.PHONY: debian/control
208debian/control: $(DEBIAN)/control.stub
29f98055 209 cp $(DEBIAN)/control.stub debian/control
29f98055
LO
210
211debian/canonical-certs.pem: $(wildcard $(DROOT)/certs/*-all.pem) $(wildcard $(DROOT)/certs/*-$(arch).pem) $(wildcard $(DEBIAN)/certs/*-all.pem) $(wildcard $(DEBIAN)/certs/*-$(arch).pem)
212 for cert in $(sort $(notdir $^)); \
213 do \
214 for dir in $(DEBIAN) $(DROOT); \
215 do \
216 if [ -f "$$dir/certs/$$cert" ]; then \
217 cat "$$dir/certs/$$cert"; \
218 break; \
219 fi; \
220 done; \
221 done >"$@"
8a151309
DJL
222
223debian/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)
224 for cert in $(sort $(notdir $^)); \
225 do \
226 for dir in $(DEBIAN) $(DROOT); \
227 do \
228 if [ -f "$$dir/revoked-certs/$$cert" ]; then \
229 cat "$$dir/revoked-certs/$$cert"; \
230 break; \
231 fi; \
232 done; \
233 done >"$@"