]>
Commit | Line | Data |
---|---|---|
78046548 AW |
1 | # Used when you need to 'escape' a comma. |
2 | comma = , | |
3 | ||
6cc28377 LO |
4 | # |
5 | # The source package name will be the first token from $(DEBIAN)/changelog | |
6 | # | |
7 | src_pkg_name=$(shell sed -n '1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN)/changelog) | |
8 | ||
9 | # Get some version info | |
6cc28377 LO |
10 | release := $(shell sed -n '1s/^$(src_pkg_name).*(\(.*\)-.*).*$$/\1/p' $(DEBIAN)/changelog) |
11 | revisions := $(shell sed -n 's/^$(src_pkg_name)\ .*($(release)-\(.*\)).*$$/\1/p' $(DEBIAN)/changelog | tac) | |
12 | revision ?= $(word $(words $(revisions)),$(revisions)) | |
13 | prev_revisions := $(filter-out $(revision),0.0 $(revisions)) | |
14 | prev_revision := $(word $(words $(prev_revisions)),$(prev_revisions)) | |
15 | ||
6c987510 AW |
16 | prev_fullver ?= $(shell dpkg-parsechangelog -l$(DEBIAN)/changelog -o1 -c1 | sed -ne 's/^Version: *//p') |
17 | ||
6cc28377 LO |
18 | family=ubuntu |
19 | ||
20 | # This is an internally used mechanism for the daily kernel builds. It | |
21 | # creates packages whose ABI is suffixed with a minimal representation of | |
22 | # the current git HEAD sha. If .git/HEAD is not present, then it uses the | |
23 | # uuidgen program, | |
24 | # | |
25 | # AUTOBUILD can also be used by anyone wanting to build a custom kernel | |
26 | # image, or rebuild the entire set of Ubuntu packages using custom patches | |
27 | # or configs. | |
28 | AUTOBUILD= | |
29 | ||
6cc28377 LO |
30 | ifneq ($(AUTOBUILD),) |
31 | skipabi = true | |
32 | skipmodule = true | |
33 | skipdbg = true | |
34 | gitver=$(shell if test -f .git/HEAD; then cat .git/HEAD; else uuidgen; fi) | |
35 | gitverpre=$(shell echo $(gitver) | cut -b -3) | |
36 | gitverpost=$(shell echo $(gitver) | cut -b 38-40) | |
37 | abi_suffix = -$(gitverpre)$(gitverpost) | |
38 | endif | |
39 | ||
40 | ifneq ($(NOKERNLOG),) | |
41 | ubuntu_log_opts += --no-kern-log | |
42 | endif | |
43 | ifneq ($(PRINTSHAS),) | |
44 | ubuntu_log_opts += --print-shas | |
45 | endif | |
46 | ||
47 | # Get the kernels own extra version to be added to the release signature. | |
48 | raw_kernelversion=$(shell make kernelversion) | |
49 | ||
50 | # | |
51 | # full_build -- are we doing a full buildd style build | |
52 | # | |
53 | ifeq ($(wildcard /CurrentlyBuilding),) | |
54 | full_build?=false | |
55 | else | |
56 | full_build?=true | |
57 | endif | |
58 | ||
59 | # | |
60 | # The debug packages are ginormous, so you probably want to skip | |
61 | # building them (as a developer). | |
62 | # | |
63 | ifeq ($(full_build),false) | |
64 | skipdbg=true | |
65 | endif | |
66 | ||
7e837649 | 67 | abinum := $(shell echo $(revision) | sed -r -e 's/([^\+~]*)\.[^\.]+(~.*)?(\+.*)?$$/\1/')$(abi_suffix) |
68 | prev_abinum := $(shell echo $(prev_revision) | sed -r -e 's/([^\+~]*)\.[^\.]+(~.*)?(\+.*)?$$/\1/')$(abi_suffix) | |
6cc28377 LO |
69 | abi_release := $(release)-$(abinum) |
70 | ||
0ab5f2fd | 71 | uploadnum := $(shell echo $(revision) | sed -r -e 's/[^\+~]*\.([^\.~]+(~.*)?(\+.*)?$$)/\1/') |
6cc28377 LO |
72 | ifneq ($(full_build),false) |
73 | uploadnum := $(uploadnum)-Ubuntu | |
74 | endif | |
75 | ||
76 | # XXX: linux-libc-dev got bumped to -803.N inadvertantly by a ti-omap4 upload | |
77 | # shift our version higher for this package only. Ensure this only | |
78 | # occurs for the v2.6.35 kernel so that we do not propogate this into | |
79 | # any other series. | |
80 | raw_uploadnum := $(shell echo $(revision) | sed -e 's/.*\.//') | |
81 | libc_dev_version := | |
82 | ifeq ($(DEBIAN),debian.master) | |
83 | ifeq ($(release),2.6.35) | |
84 | libc_dev_version := -v$(release)-$(shell expr "$(abinum)" + 1000).$(raw_uploadnum) | |
85 | endif | |
86 | endif | |
87 | ||
88 | DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) | |
89 | DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) | |
90 | DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) | |
91 | DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH) | |
92 | DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH) | |
93 | ||
94 | # | |
374c4d89 | 95 | # Detect invocations of the form 'fakeroot debian/rules binary arch=armhf' |
6cc28377 LO |
96 | # within an x86'en schroot. This only gets you part of the way since the |
97 | # packaging phase fails, but you can at least compile the kernel quickly. | |
98 | # | |
99 | arch := $(DEB_HOST_ARCH) | |
100 | ifneq ($(arch),$(DEB_HOST_ARCH)) | |
101 | CROSS_COMPILE ?= $(shell dpkg-architecture -a$(arch) -qDEB_HOST_GNU_TYPE -f 2>/dev/null)- | |
102 | endif | |
103 | ||
104 | # | |
374c4d89 | 105 | # Detect invocations of the form 'dpkg-buildpackage -B -aarmhf' within |
6cc28377 LO |
106 | # an x86'en schroot. This is the only way to build all of the packages |
107 | # (except for tools). | |
108 | # | |
109 | ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) | |
110 | CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)- | |
111 | endif | |
112 | ||
113 | abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch) | |
114 | prev_abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(prev_revision)/$(arch) | |
115 | commonconfdir := $(CURDIR)/$(DEBIAN)/config | |
116 | archconfdir := $(CURDIR)/$(DEBIAN)/config/$(arch) | |
117 | sharedconfdir := $(CURDIR)/debian.master/config | |
118 | builddir := $(CURDIR)/debian/build | |
119 | stampdir := $(CURDIR)/debian/stamps | |
120 | ||
121 | # | |
122 | # The binary package name always starts with linux-image-$KVER-$ABI.$UPLOAD_NUM. There | |
123 | # are places that you'll find linux-image hard coded, but I guess thats OK since the | |
124 | # assumption that the binary package always starts with linux-image will never change. | |
125 | # | |
126 | bin_pkg_name=linux-image-$(abi_release) | |
127 | extra_pkg_name=linux-image-extra-$(abi_release) | |
128 | hdrs_pkg_name=linux-headers-$(abi_release) | |
813489f7 | 129 | indep_hdrs_pkg_name=$(src_pkg_name)-headers-$(abi_release) |
23b893cb | 130 | |
6cc28377 LO |
131 | # |
132 | # The generation of content in the doc package depends on both 'AUTOBUILD=' and | |
133 | # 'do_doc_package_content=true'. There are usually build errors during the development | |
134 | # cycle, so its OK to leave 'do_doc_package_content=false' until those build | |
135 | # failures get sorted out. Finally, the doc package doesn't really need to be built | |
136 | # for developer testing (its kind of slow), so only do it if on a buildd. | |
137 | do_doc_package=true | |
138 | do_doc_package_content=true | |
139 | ifeq ($(full_build),false) | |
140 | do_doc_package_content=false | |
141 | endif | |
142 | doc_pkg_name=$(src_pkg_name)-doc | |
143 | ||
144 | # | |
145 | # Similarly with the linux-source package, you need not build it as a developer. Its | |
146 | # somewhat I/O intensive and utterly useless. | |
147 | # | |
148 | do_source_package=true | |
149 | do_source_package_content=true | |
150 | ifeq ($(full_build),false) | |
151 | do_source_package_content=false | |
152 | endif | |
153 | ||
154 | # linux-libc-dev may not be needed, default to building it. | |
155 | do_libc_dev_package=true | |
156 | ||
157 | # common headers normally is built as an indep package, but may be arch | |
158 | do_common_headers_indep=true | |
159 | ||
160 | # add a 'full source' mode | |
161 | do_full_source=false | |
162 | ||
163 | # build tools | |
164 | ifneq ($(wildcard $(CURDIR)/tools),) | |
165 | ifeq ($(do_tools),) | |
166 | ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE)) | |
167 | do_tools=false | |
168 | endif | |
169 | endif | |
170 | do_tools?=true | |
171 | else | |
172 | do_tools?=false | |
173 | endif | |
174 | tools_pkg_name=$(src_pkg_name)-tools-$(abi_release) | |
175 | tools_common_pkg_name=$(src_pkg_name)-tools-common | |
464a8a56 | 176 | tools_flavour_pkg_name=linux-tools-$(abi_release) |
abbb6db5 TG |
177 | cloud_pkg_name=$(src_pkg_name)-cloud-tools-$(abi_release) |
178 | cloud_common_pkg_name=$(src_pkg_name)-cloud-tools-common | |
179 | cloud_flavour_pkg_name=linux-cloud-tools-$(abi_release) | |
6cc28377 LO |
180 | |
181 | # The general flavour specific image package. | |
182 | do_flavour_image_package=true | |
183 | ||
184 | # The general flavour specific header package. | |
185 | do_flavour_header_package=true | |
186 | ||
fbe45706 AW |
187 | # DTBs |
188 | do_dtbs=false | |
189 | ||
6cc28377 LO |
190 | # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008) |
191 | # | |
192 | # These 2 environment variables set the -j value of the kernel build. For example, | |
193 | # CONCURRENCY_LEVEL=16 fakeroot $(DEBIAN)/rules binary-debs | |
194 | # or | |
195 | # DEB_BUILD_OPTIONS=parallel=16 fakeroot $(DEBIAN)/rules binary-debs | |
196 | # | |
197 | # The default is to use the number of CPUs. | |
198 | # | |
199 | COMMA=, | |
200 | DEB_BUILD_OPTIONS_PARA = $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) | |
201 | ifneq (,$(DEB_BUILD_OPTIONS_PARA)) | |
202 | CONCURRENCY_LEVEL := $(DEB_BUILD_OPTIONS_PARA) | |
203 | endif | |
204 | ||
205 | ifeq ($(CONCURRENCY_LEVEL),) | |
206 | # Check the environment | |
207 | CONCURRENCY_LEVEL := $(shell echo $$CONCURRENCY_LEVEL) | |
208 | # No? Then build with the number of CPUs on the host. | |
209 | ifeq ($(CONCURRENCY_LEVEL),) | |
210 | CONCURRENCY_LEVEL := $(shell expr `getconf _NPROCESSORS_ONLN` \* 1) | |
211 | endif | |
212 | # Oh hell, give 'em one | |
213 | ifeq ($(CONCURRENCY_LEVEL),) | |
214 | CONCURRENCY_LEVEL := 1 | |
215 | endif | |
216 | endif | |
217 | ||
218 | conc_level = -j$(CONCURRENCY_LEVEL) | |
219 | ||
220 | # target_flavour is filled in for each step | |
221 | kmake = make ARCH=$(build_arch) \ | |
222 | CROSS_COMPILE=$(CROSS_COMPILE) \ | |
223 | KERNELVERSION=$(abi_release)-$(target_flavour) \ | |
224 | CONFIG_DEBUG_SECTION_MISMATCH=y \ | |
225 | KBUILD_BUILD_VERSION="$(uploadnum)" \ | |
87aacaf2 TG |
226 | LOCALVERSION= localver-extra= \ |
227 | CFLAGS_MODULE="-DPKG_ABI=$(abinum)" | |
6cc28377 LO |
228 | ifneq ($(LOCAL_ENV_CC),) |
229 | kmake += CC=$(LOCAL_ENV_CC) DISTCC_HOSTS=$(LOCAL_ENV_DISTCC_HOSTS) | |
230 | endif | |
231 | ||
232 | # Locking is required in parallel builds to prevent loss of contents | |
233 | # of the debian/files. | |
234 | lockme_file = $(CURDIR)/debian/.LOCK | |
235 | lockme_cmd = flock -w 60 | |
236 | lockme = $(lockme_cmd) $(lockme_file) | |
0a84cf89 | 237 | |
ffb89852 TG |
238 | # Don't fail if a link already exists. |
239 | LN = ln -sf | |
240 | ||
0a84cf89 BC |
241 | # Checks if a var is overriden by the custom rules. Called with var and |
242 | # flavour as arguments. | |
243 | custom_override = \ | |
244 | $(shell if [ -n "$($(1)_$(2))" ]; then echo "$($(1)_$(2))"; else echo "$($(1))"; fi) |