2 # The source package name will be the first token from $(DEBIAN)/changelog
4 src_pkg_name
=$(shell sed
-n
'1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN
)/changelog
)
6 # Get some version info
7 release
:= $(shell sed
-n
'1s/^$(src_pkg_name).*(\(.*\)-.*).*$$/\1/p' $(DEBIAN
)/changelog
)
8 revisions
:= $(shell sed
-n
's/^$(src_pkg_name)\ .*($(release)-\(.*\)).*$$/\1/p' $(DEBIAN
)/changelog | tac
)
9 revision ?
= $(word $(words $(revisions
)),$(revisions
))
10 prev_revisions
:= $(filter-out $(revision
),0.0 $(revisions
))
11 prev_revision
:= $(word $(words $(prev_revisions
)),$(prev_revisions
))
13 prev_fullver ?
= $(shell dpkg-parsechangelog
-l
$(DEBIAN
)/changelog
-o1
-c1 | sed
-ne
's/^Version: *//p')
17 # This is an internally used mechanism for the daily kernel builds. It
18 # creates packages whose ABI is suffixed with a minimal representation of
19 # the current git HEAD sha. If .git/HEAD is not present, then it uses the
22 # AUTOBUILD can also be used by anyone wanting to build a custom kernel
23 # image, or rebuild the entire set of Ubuntu packages using custom patches
31 gitver
=$(shell if
test -f .git
/HEAD
; then cat .git
/HEAD
; else uuidgen
; fi
)
32 gitverpre
=$(shell echo
$(gitver
) | cut
-b
-3)
33 gitverpost
=$(shell echo
$(gitver
) | cut
-b
38-40)
34 abi_suffix
= -$(gitverpre
)$(gitverpost
)
38 ubuntu_log_opts
+= --no-kern-log
41 ubuntu_log_opts
+= --print-shas
44 # Get the kernels own extra version to be added to the release signature.
45 raw_kernelversion
=$(shell make kernelversion
)
48 # full_build -- are we doing a full buildd style build
50 ifeq ($(wildcard /CurrentlyBuilding
),)
57 # The debug packages are ginormous, so you probably want to skip
58 # building them (as a developer).
60 ifeq ($(full_build
),false
)
64 abinum
:= $(shell echo
$(revision
) | sed
-e
's/\..*//')$(abi_suffix
)
65 prev_abinum
:= $(shell echo
$(prev_revision
) | sed
-e
's/\..*//')$(abi_suffix
)
66 abi_release
:= $(release
)-$(abinum
)
68 uploadnum
:= $(shell echo
$(revision
) | sed
-e
's/.*\.//')
69 ifneq ($(full_build
),false
)
70 uploadnum
:= $(uploadnum
)-Ubuntu
73 # XXX: linux-libc-dev got bumped to -803.N inadvertantly by a ti-omap4 upload
74 # shift our version higher for this package only. Ensure this only
75 # occurs for the v2.6.35 kernel so that we do not propogate this into
77 raw_uploadnum
:= $(shell echo
$(revision
) | sed
-e
's/.*\.//')
79 ifeq ($(DEBIAN
),debian.master
)
80 ifeq ($(release
),2.6.35)
81 libc_dev_version
:= -v
$(release
)-$(shell expr
"$(abinum)" + 1000).
$(raw_uploadnum
)
85 DEB_HOST_MULTIARCH
= $(shell dpkg-architecture
-qDEB_HOST_MULTIARCH
)
86 DEB_HOST_GNU_TYPE
= $(shell dpkg-architecture
-qDEB_HOST_GNU_TYPE
)
87 DEB_BUILD_GNU_TYPE
= $(shell dpkg-architecture
-qDEB_BUILD_GNU_TYPE
)
88 DEB_HOST_ARCH
= $(shell dpkg-architecture
-qDEB_HOST_ARCH
)
89 DEB_BUILD_ARCH
= $(shell dpkg-architecture
-qDEB_BUILD_ARCH
)
92 # Detect invocations of the form 'fakeroot debian/rules binary arch=armhf'
93 # within an x86'en schroot. This only gets you part of the way since the
94 # packaging phase fails, but you can at least compile the kernel quickly.
96 arch
:= $(DEB_HOST_ARCH
)
97 ifneq ($(arch
),$(DEB_HOST_ARCH
))
98 CROSS_COMPILE ?
= $(shell dpkg-architecture
-a
$(arch
) -qDEB_HOST_GNU_TYPE
-f
2>/dev
/null
)-
102 # Detect invocations of the form 'dpkg-buildpackage -B -aarmhf' within
103 # an x86'en schroot. This is the only way to build all of the packages
104 # (except for tools).
106 ifneq ($(DEB_BUILD_GNU_TYPE
),$(DEB_HOST_GNU_TYPE
))
107 CROSS_COMPILE ?
= $(DEB_HOST_GNU_TYPE
)-
110 abidir
:= $(CURDIR
)/$(DEBIAN
)/abi
/$(release
)-$(revision
)/$(arch
)
111 prev_abidir
:= $(CURDIR
)/$(DEBIAN
)/abi
/$(release
)-$(prev_revision
)/$(arch
)
112 commonconfdir
:= $(CURDIR
)/$(DEBIAN
)/config
113 archconfdir
:= $(CURDIR
)/$(DEBIAN
)/config
/$(arch
)
114 sharedconfdir
:= $(CURDIR
)/debian.master
/config
115 builddir
:= $(CURDIR
)/debian
/build
116 stampdir
:= $(CURDIR
)/debian
/stamps
119 # The binary package name always starts with linux-image-$KVER-$ABI.$UPLOAD_NUM. There
120 # are places that you'll find linux-image hard coded, but I guess thats OK since the
121 # assumption that the binary package always starts with linux-image will never change.
123 bin_pkg_name
=linux-image-
$(abi_release
)
124 extra_pkg_name
=linux-image-extra-
$(abi_release
)
125 hdrs_pkg_name
=linux-headers-
$(abi_release
)
126 indep_hdrs_pkg_name
=$(src_pkg_name
)-headers-
$(abi_release
)
129 # The generation of content in the doc package depends on both 'AUTOBUILD=' and
130 # 'do_doc_package_content=true'. There are usually build errors during the development
131 # cycle, so its OK to leave 'do_doc_package_content=false' until those build
132 # failures get sorted out. Finally, the doc package doesn't really need to be built
133 # for developer testing (its kind of slow), so only do it if on a buildd.
135 do_doc_package_content
=true
136 ifeq ($(full_build
),false
)
137 do_doc_package_content
=false
139 doc_pkg_name
=$(src_pkg_name
)-doc
142 # Similarly with the linux-source package, you need not build it as a developer. Its
143 # somewhat I/O intensive and utterly useless.
145 do_source_package
=true
146 do_source_package_content
=true
147 ifeq ($(full_build
),false
)
148 do_source_package_content
=false
151 # linux-libc-dev may not be needed, default to building it.
152 do_libc_dev_package
=true
154 # common headers normally is built as an indep package, but may be arch
155 do_common_headers_indep
=true
157 # add a 'full source' mode
161 ifneq ($(wildcard $(CURDIR
)/tools
),)
163 ifneq ($(DEB_BUILD_GNU_TYPE
),$(DEB_HOST_GNU_TYPE
))
171 tools_pkg_name
=$(src_pkg_name
)-tools-
$(abi_release
)
172 tools_common_pkg_name
=$(src_pkg_name
)-tools-common
174 # The general flavour specific image package.
175 do_flavour_image_package
=true
177 # The general flavour specific header package.
178 do_flavour_header_package
=true
180 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
182 # These 2 environment variables set the -j value of the kernel build. For example,
183 # CONCURRENCY_LEVEL=16 fakeroot $(DEBIAN)/rules binary-debs
185 # DEB_BUILD_OPTIONS=parallel=16 fakeroot $(DEBIAN)/rules binary-debs
187 # The default is to use the number of CPUs.
190 DEB_BUILD_OPTIONS_PARA
= $(subst parallel
=,,$(filter parallel
=%,$(subst $(COMMA
), ,$(DEB_BUILD_OPTIONS
))))
191 ifneq (,$(DEB_BUILD_OPTIONS_PARA
))
192 CONCURRENCY_LEVEL
:= $(DEB_BUILD_OPTIONS_PARA
)
195 ifeq ($(CONCURRENCY_LEVEL
),)
196 # Check the environment
197 CONCURRENCY_LEVEL
:= $(shell echo
$$CONCURRENCY_LEVEL)
198 # No? Then build with the number of CPUs on the host.
199 ifeq ($(CONCURRENCY_LEVEL
),)
200 CONCURRENCY_LEVEL
:= $(shell expr
`getconf _NPROCESSORS_ONLN` \
* 1)
202 # Oh hell, give 'em one
203 ifeq ($(CONCURRENCY_LEVEL
),)
204 CONCURRENCY_LEVEL
:= 1
208 conc_level
= -j
$(CONCURRENCY_LEVEL
)
210 # target_flavour is filled in for each step
211 kmake
= make ARCH
=$(build_arch
) \
212 CROSS_COMPILE
=$(CROSS_COMPILE
) \
213 KERNELVERSION
=$(abi_release
)-$(target_flavour
) \
214 CONFIG_DEBUG_SECTION_MISMATCH
=y \
215 KBUILD_BUILD_VERSION
="$(uploadnum)" \
216 LOCALVERSION
= localver-extra
= \
217 CFLAGS_MODULE
="-DPKG_ABI=$(abinum)"
218 ifneq ($(LOCAL_ENV_CC
),)
219 kmake
+= CC
=$(LOCAL_ENV_CC
) DISTCC_HOSTS
=$(LOCAL_ENV_DISTCC_HOSTS
)
222 # Locking is required in parallel builds to prevent loss of contents
223 # of the debian/files.
224 lockme_file
= $(CURDIR
)/debian
/.LOCK
225 lockme_cmd
= flock
-w
60
226 lockme
= $(lockme_cmd
) $(lockme_file
)
228 # Checks if a var is overriden by the custom rules. Called with var and
229 # flavour as arguments.
231 $(shell if
[ -n
"$($(1)_$(2))" ]; then echo
"$($(1)_$(2))"; else echo
"$($(1))"; fi
)