]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blame - debian/rules
UBUNTU: Ubuntu-5.10.0-11.12
[mirror_ubuntu-hirsute-kernel.git] / debian / rules
CommitLineData
4be6d2ac
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
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
49 do_dkms_nvidia_server=false
50endif
51
52# Are any of the kernel signing options enabled.
53any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed) $(sipl_signed)))
54ifeq ($(any_signed),true)
55bin_pkg_name=$(bin_pkg_name_unsigned)
56else
57bin_pkg_name=$(bin_pkg_name_signed)
58endif
59
60# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
61ifeq ($(DEB_STAGE),stage1)
62 DEB_BUILD_PROFILES=stage1
63endif
64ifneq ($(DEB_BUILD_PROFILE),)
65 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
66endif
67ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
68 do_tools=false
69 do_doc_package=false
70 do_source_package=false
71 do_flavour_image_package=false
72 do_flavour_header_package=false
73endif
74
75# autopkgtest -- rebuild support
76# - only build the first flavour on the assumption it is representative
77# - disable dkms builds as the versions used may have been deleted
78ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
79 flavours := $(firstword $(flavours))
80 disable_d_i=true
81 do_zfs=false
82 do_dkms_nvidia=false
83 do_dkms_nvidia_server=false
84endif
85
86# Being used to build a mainline build -- turn off things which do not work.
87ifeq ($(do_mainline_build),true)
88 do_extras_package=false
89 do_tools=false
90 no_dumpfile=1
91 do_zfs=false
92 do_dkms_nvidia=false
93 do_dkms_nvidia_server=false
94 skipabi=true
95 skipmodule=true
96 skipretpoline=true
97endif
98
99# Disable tools build and packaging if do_tools != true
100ifneq ($(do_tools),true)
101 do_linux_tools=
102 do_cloud_tools=
103 do_tools_common=
104 do_tools_host=
105endif
106
107ifeq ($(do_zfs),false)
108 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)
109endif
110
111ifeq ($(do_dkms_wireguard),false)
112 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)
113endif
114
115# Either tools package needs the common source preparation
116do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
117
118# Versions of dkms packages.
119dkms_zfs_linux_version=$(shell gawk '/^zfs-linux / { print $$2; }' debian/dkms-versions)
120dkms_nvidia_390_version=$(shell gawk '/^nvidia-graphics-drivers-390 / { print $$2; }' debian/dkms-versions)
4be6d2ac 121dkms_nvidia_450_version=$(shell gawk '/^nvidia-graphics-drivers-450 / { print $$2; }' debian/dkms-versions)
a4ee9351 122dkms_nvidia_460_version=$(shell gawk '/^nvidia-graphics-drivers-460 / { print $$2; }' debian/dkms-versions)
4be6d2ac
LO
123dkms_nvidia_418_server_version=$(shell gawk '/^nvidia-graphics-drivers-418-server / { print $$2; }' debian/dkms-versions)
124dkms_nvidia_440_server_version=$(shell gawk '/^nvidia-graphics-drivers-440-server / { print $$2; }' debian/dkms-versions)
125dkms_nvidia_450_server_version=$(shell gawk '/^nvidia-graphics-drivers-450-server / { print $$2; }' debian/dkms-versions)
126
127# Debian Build System targets
128binary: binary-indep binary-arch
129
130build: build-arch build-indep
131
132clean: debian/control
133 dh_testdir
134 dh_testroot
135 dh_clean
136
137 # d-i stuff
138 rm -rf $(DEBIAN)/d-i-$(arch)
139 # Generated on the fly.
140 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
141
142 # normal build junk
143 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
144 rm -rf $(builddir)
145 rm -f $(stampdir)/stamp-*
146 rm -rf $(DEBIAN)/linux-*
147
148 # This gets rid of the d-i packages in control
149 cp -f $(DEBIAN)/control.stub $(DROOT)/control
150 cp $(DEBIAN)/changelog debian/changelog
151
152 # Install the copyright information.
153 cp $(DEBIAN)/copyright debian/copyright
154
155 # Install the retpoline extractor.
156 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
157
158 # If we have a reconstruct script use it.
159 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct || true
160
161 # Remove generated intermediate files
162 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
163 rm -f $(DROOT)/scripts/fix-filenames
164
165distclean: clean
166 rm -rf $(DROOT)/control debian/changelog \
167 debian/control debian/control.stub debian/copyright \
168 scripts/ubuntu-retpoline-extract-one
169
170# Builds the image, arch headers and debug packages
171include $(DROOT)/rules.d/2-binary-arch.mk
172
173# Rules for building the udebs ($(DEBIAN)-installer)
174include $(DROOT)/rules.d/5-udebs.mk
175
176# Builds the source, doc and linux-headers indep packages
177include $(DROOT)/rules.d/3-binary-indep.mk
178
179# Various checks to be performed on builds
180include $(DROOT)/rules.d/4-checks.mk
181
182control_files := $(DEBIAN)/control.stub.in
183ifeq ($(do_libc_dev_package),true)
184ifneq (,$(wildcard $(DEBIAN)/control.d/linux-libc-dev.stub))
185 control_files += $(DEBIAN)/control.d/linux-libc-dev.stub
186endif
187endif
188ifeq ($(do_doc_package),true)
189ifneq (,$(wildcard $(DEBIAN)/control.d/linux-doc.stub))
190 control_files += $(DEBIAN)/control.d/linux-doc.stub
191endif
192endif
193
194# Misc stuff
195.PHONY: $(DEBIAN)/control.stub
196$(DEBIAN)/control.stub: \
197 $(DROOT)/scripts/control-create \
198 $(control_files) \
199 $(DEBIAN)/changelog \
200 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
201 for i in $(control_files); do \
202 cat $$i; \
203 echo ""; \
204 done | sed -e 's/PKGVER/$(release)/g' \
205 -e 's/ABINUM/$(abinum)/g' \
206 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
207 -e 's/=HUMAN=/$(human_arch)/g' \
208 -e 's/=SERIES=/$(series)/g' \
209 > $(DEBIAN)/control.stub;
210 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
211 for i in $$flavours; do \
212 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
213 sed -e 's/PKGVER/$(release)/g' \
214 -e 's/ABINUM/$(abinum)/g' \
215 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
216 -e 's/=HUMAN=/$(human_arch)/g' \
217 -e 's/=SERIES=/$(series)/g' \
218 >> $(DEBIAN)/control.stub; \
219 done
220
221.PHONY: debian/control
222debian/control: $(DEBIAN)/control.stub
223 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
224 cp $(DEBIAN)/control.stub debian/control
225 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
226 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
227 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
228 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
229 >>$(CURDIR)/debian/control