]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - debian/rules
drm/i915: Save the old CDCLK atomic state
[mirror_ubuntu-bionic-kernel.git] / debian / rules
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
10 DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
11
12 # dpkg-buildpackage passes options that are incomptatible
13 # with the kernel build.
14 unexport CFLAGS
15 unexport LDFLAGS
16
17 export LC_ALL=C
18 export SHELL=/bin/bash -e
19
20 # Where do we find the common configuration.
21 export DROOT=debian
22
23 # Common variables for all architectures
24 include $(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
34 include $(DROOT)/rules.d/1-maintainer.mk
35
36 do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_x86)))
37 do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
38 do_tools_common?=true
39 do_tools_host?=false
40 do_tools_perf_jvmti?=false
41
42 # Don't build tools or udebs in a cross compile environment.
43 ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
44 do_tools=false
45 disable_d_i=true
46 do_zfs=false
47 endif
48
49 # Are any of the kernel signing options enabled.
50 any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed)))
51 ifeq ($(any_signed),true)
52 bin_pkg_name=$(bin_pkg_name_unsigned)
53 else
54 bin_pkg_name=$(bin_pkg_name_signed)
55 endif
56
57 # Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
58 ifeq ($(DEB_STAGE),stage1)
59 DEB_BUILD_PROFILES=stage1
60 endif
61 ifneq ($(DEB_BUILD_PROFILE),)
62 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
63 endif
64 ifneq ($(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
70 endif
71
72 # Being used to build a mainline build -- turn off things which do not work.
73 ifeq ($(do_mainline_build),true)
74 do_extras_package=false
75 do_tools=false
76 no_dumpfile=1
77 do_zfs=false
78 skipabi=true
79 skipmodule=true
80 skipretpoline=true
81 endif
82
83 # Disable tools build and packaging if do_tools != true
84 ifneq ($(do_tools),true)
85 do_linux_tools=
86 do_cloud_tools=
87 do_tools_common=
88 do_tools_host=
89 endif
90
91 ifeq ($(do_zfs),false)
92 do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore)
93 endif
94
95 # Either tools package needs the common source preparation
96 do_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
100 ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
101 flavours := $(firstword $(flavours))
102 disable_d_i=true
103 endif
104
105 # Debian Build System targets
106 binary: binary-indep binary-arch
107
108 build: build-arch build-indep
109
110 clean: debian/control
111 dh_testdir
112 dh_testroot
113 dh_clean
114
115 # d-i stuff
116 rm -rf $(DEBIAN)/d-i-$(arch)
117 # Generated on the fly.
118 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
119
120 # normal build junk
121 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
122 rm -rf $(builddir)
123 rm -f $(stampdir)/stamp-*
124 rm -rf $(DEBIAN)/linux-*
125
126 # This gets rid of the d-i packages in control
127 cp -f $(DEBIAN)/control.stub $(DROOT)/control
128 cp $(DEBIAN)/changelog debian/changelog
129
130 # Install the copyright information.
131 cp $(DEBIAN)/copyright debian/copyright
132
133 # Install the retpoline extractor.
134 cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one
135
136 # If we have a reconstruct script use it.
137 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct
138
139 # Remove generated intermediate files
140 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
141
142 distclean: clean
143 rm -rf $(DROOT)/control debian/changelog \
144 debian/control debian/control.stub debian/copyright \
145 scripts/ubuntu-retpoline-extract-one
146
147 # Builds the image, arch headers and debug packages
148 include $(DROOT)/rules.d/2-binary-arch.mk
149
150 # Rules for building the udebs ($(DEBIAN)-installer)
151 include $(DROOT)/rules.d/5-udebs.mk
152
153 # Builds the source, doc and linux-headers indep packages
154 include $(DROOT)/rules.d/3-binary-indep.mk
155
156 # Various checks to be performed on builds
157 include $(DROOT)/rules.d/4-checks.mk
158
159 # Misc stuff
160 .PHONY: $(DEBIAN)/control.stub
161 $(DEBIAN)/control.stub: \
162 $(DROOT)/scripts/control-create \
163 $(DEBIAN)/control.stub.in \
164 $(DEBIAN)/changelog \
165 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
166 for i in $(DEBIAN)/control.stub.in; do \
167 new=`echo $$i | sed 's/\.in$$//'`; \
168 cat $$i | sed -e 's/PKGVER/$(release)/g' \
169 -e 's/ABINUM/$(abinum)/g' \
170 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
171 -e 's/=HUMAN=/$(human_arch)/g' \
172 > $$new; \
173 done
174 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
175 for i in $$flavours; do \
176 $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \
177 sed -e 's/PKGVER/$(release)/g' \
178 -e 's/ABINUM/$(abinum)/g' \
179 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
180 -e 's/=HUMAN=/$(human_arch)/g' \
181 >> $(DEBIAN)/control.stub; \
182 done
183
184 .PHONY: debian/control
185 debian/control: $(DEBIAN)/control.stub
186 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
187 cp $(DEBIAN)/control.stub debian/control
188 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
189 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
190 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
191 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
192 >>$(CURDIR)/debian/control