]>
Commit | Line | Data |
---|---|---|
0d34a427 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 | ||
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))) | |
9b18b291 | 38 | do_tools_common?=true |
f66a0ec7 | 39 | do_tools_host?=false |
0d34a427 LO |
40 | |
41 | # Don't build tools or udebs in a cross compile environment. | |
42 | ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) | |
43 | do_tools=false | |
44 | disable_d_i=true | |
45 | do_zfs=false | |
0d34a427 LO |
46 | endif |
47 | ||
b90b1fe0 | 48 | # Are any of the kernel signing options enabled. |
d074ecae | 49 | any_signed=$(sort $(filter-out false,$(uefi_signed) $(opal_signed))) |
b90b1fe0 AW |
50 | ifeq ($(any_signed),true) |
51 | bin_pkg_name=$(bin_pkg_name_unsigned) | |
52 | else | |
53 | bin_pkg_name=$(bin_pkg_name_signed) | |
54 | endif | |
55 | ||
0d34a427 LO |
56 | # Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap |
57 | ifeq ($(DEB_STAGE),stage1) | |
58 | DEB_BUILD_PROFILES=stage1 | |
59 | endif | |
60 | ifneq ($(DEB_BUILD_PROFILE),) | |
61 | DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE) | |
62 | endif | |
63 | ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),) | |
64 | do_tools=false | |
65 | do_doc_package=false | |
66 | do_source_package=false | |
67 | do_flavour_image_package=false | |
68 | do_flavour_header_package=false | |
69 | endif | |
70 | ||
71 | # Being used to build a mainline build -- turn off things which do not work. | |
72 | ifeq ($(do_mainline_build),true) | |
73 | do_extras_package=false | |
74 | do_tools=false | |
75 | no_dumpfile=1 | |
76 | do_zfs=false | |
0fa05ca6 AW |
77 | skipabi=true |
78 | skipmodule=true | |
79 | skipretpoline=true | |
0d34a427 LO |
80 | endif |
81 | ||
82 | # Disable tools build and packaging if do_tools != true | |
83 | ifneq ($(do_tools),true) | |
84 | do_linux_tools= | |
85 | do_cloud_tools= | |
86 | do_tools_common= | |
f66a0ec7 | 87 | do_tools_host= |
0d34a427 LO |
88 | endif |
89 | ||
f13b795d AW |
90 | ifeq ($(do_zfs),false) |
91 | do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore) | |
92 | endif | |
93 | ||
0d34a427 LO |
94 | # Either tools package needs the common source preparation |
95 | do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools))) | |
96 | ||
97 | # autopkgtest -- rebuild support | |
98 | # only build the first flavour on the assumption it is representative | |
2c21160b | 99 | ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),) |
0d34a427 | 100 | flavours := $(firstword $(flavours)) |
2c21160b | 101 | disable_d_i=true |
0d34a427 LO |
102 | endif |
103 | ||
104 | # Debian Build System targets | |
105 | binary: binary-indep binary-arch | |
106 | ||
107 | build: build-arch build-indep | |
108 | ||
109 | clean: debian/control | |
110 | dh_testdir | |
111 | dh_testroot | |
112 | dh_clean | |
113 | ||
114 | # d-i stuff | |
115 | rm -rf $(DEBIAN)/d-i-$(arch) | |
116 | # Generated on the fly. | |
117 | rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image | |
118 | ||
119 | # normal build junk | |
120 | rm -rf $(DEBIAN)/abi/$(release)-$(revision) | |
121 | rm -rf $(builddir) | |
122 | rm -f $(stampdir)/stamp-* | |
123 | rm -rf $(DEBIAN)/linux-* | |
124 | ||
125 | # This gets rid of the d-i packages in control | |
126 | cp -f $(DEBIAN)/control.stub $(DROOT)/control | |
127 | cp $(DEBIAN)/changelog debian/changelog | |
128 | ||
129 | # Install the copyright information. | |
130 | cp $(DEBIAN)/copyright debian/copyright | |
131 | ||
527d1e11 AW |
132 | # Install the retpoline extractor. |
133 | cp $(DROOT)/scripts/retpoline-extract-one scripts/ubuntu-retpoline-extract-one | |
134 | ||
0d34a427 LO |
135 | # If we have a reconstruct script use it. |
136 | [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct | |
137 | ||
138 | # Remove generated intermediate files | |
139 | rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub | |
140 | ||
141 | distclean: clean | |
142 | rm -rf $(DROOT)/control debian/changelog \ | |
527d1e11 AW |
143 | debian/control debian/control.stub debian/copyright \ |
144 | scripts/ubuntu-retpoline-extract-one | |
0d34a427 LO |
145 | |
146 | # Builds the image, arch headers and debug packages | |
147 | include $(DROOT)/rules.d/2-binary-arch.mk | |
148 | ||
149 | # Rules for building the udebs ($(DEBIAN)-installer) | |
150 | include $(DROOT)/rules.d/5-udebs.mk | |
151 | ||
152 | # Builds the source, doc and linux-headers indep packages | |
153 | include $(DROOT)/rules.d/3-binary-indep.mk | |
154 | ||
155 | # Various checks to be performed on builds | |
156 | include $(DROOT)/rules.d/4-checks.mk | |
157 | ||
158 | # Misc stuff | |
159 | .PHONY: $(DEBIAN)/control.stub | |
160 | $(DEBIAN)/control.stub: \ | |
161 | $(DROOT)/scripts/control-create \ | |
162 | $(DEBIAN)/control.stub.in \ | |
163 | $(DEBIAN)/changelog \ | |
164 | $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars) | |
165 | for i in $(DEBIAN)/control.stub.in; do \ | |
166 | new=`echo $$i | sed 's/\.in$$//'`; \ | |
167 | cat $$i | sed -e 's/PKGVER/$(release)/g' \ | |
168 | -e 's/ABINUM/$(abinum)/g' \ | |
169 | -e 's/SRCPKGNAME/$(src_pkg_name)/g' \ | |
170 | -e 's/=HUMAN=/$(human_arch)/g' \ | |
171 | > $$new; \ | |
172 | done | |
173 | flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\ | |
174 | for i in $$flavours; do \ | |
b90b1fe0 | 175 | $(SHELL) $(DROOT)/scripts/control-create $$i "$(any_signed)" | \ |
0d34a427 LO |
176 | sed -e 's/PKGVER/$(release)/g' \ |
177 | -e 's/ABINUM/$(abinum)/g' \ | |
178 | -e 's/SRCPKGNAME/$(src_pkg_name)/g' \ | |
179 | -e 's/=HUMAN=/$(human_arch)/g' \ | |
180 | >> $(DEBIAN)/control.stub; \ | |
181 | done | |
182 | ||
183 | .PHONY: debian/control | |
184 | debian/control: $(DEBIAN)/control.stub | |
185 | echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub | |
186 | cp $(DEBIAN)/control.stub debian/control | |
187 | export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \ | |
188 | export KW_CONFIG_DIR=$(DEBIAN)/d-i && \ | |
189 | LANG=C kernel-wedge gen-control $(release)-$(abinum) | \ | |
190 | perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \ | |
191 | >>$(CURDIR)/debian/control |