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