UBUNTU: purge last vestiges of maverick
[linux-flexiantxendom0-natty.git] / debian / rules.d / 0-common-vars.mk
1 #
2 # The source package name will be the first token from $(DEBIAN)/changelog
3 #
4 src_pkg_name=$(shell sed -n '1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN)/changelog)
5
6 # Get some version info
7 series := natty
8 release := $(shell sed -n '1s/^$(src_pkg_name).*(\(.*\)-.*).*$$/\1/p' $(DEBIAN)/changelog)
9 revisions := $(shell sed -n 's/^$(src_pkg_name)\ .*($(release)-\(.*\)).*$$/\1/p' $(DEBIAN)/changelog | tac)
10 revision ?= $(word $(words $(revisions)),$(revisions))
11 prev_revisions := $(filter-out $(revision),0.0 $(revisions))
12 prev_revision := $(word $(words $(prev_revisions)),$(prev_revisions))
13
14 family=ubuntu
15
16 # This is an internally used mechanism for the daily kernel builds. It
17 # creates packages whose ABI is suffixed with a minimal representation of
18 # the current git HEAD sha. If .git/HEAD is not present, then it uses the
19 # uuidgen program,
20 #
21 # AUTOBUILD can also be used by anyone wanting to build a custom kernel
22 # image, or rebuild the entire set of Ubuntu packages using custom patches
23 # or configs.
24 AUTOBUILD=
25
26 #
27 # This is a way to support some external variables. A good example is
28 # a local setup for ccache and distcc See LOCAL_ENV_CC and
29 # LOCAL_ENV_DISTCC_HOSTS in the definition of kmake.
30 # For example:
31 #      LOCAL_ENV_CC="ccache distcc"
32 #      LOCAL_ENV_DISTCC_HOSTS="localhost 10.0.2.5 10.0.2.221"
33 #
34 -include $(CURDIR)/../.$(series)-env
35
36 ifneq ($(AUTOBUILD),)
37 skipabi         = true
38 skipmodule      = true
39 skipdbg         = true
40 gitver=$(shell if test -f .git/HEAD; then cat .git/HEAD; else uuidgen; fi)
41 gitverpre=$(shell echo $(gitver) | cut -b -3)
42 gitverpost=$(shell echo $(gitver) | cut -b 38-40)
43 abi_suffix = -$(gitverpre)$(gitverpost)
44 endif
45
46 ifneq ($(NOKERNLOG),)
47 ubuntu_log_opts += --no-kern-log
48 endif
49 ifneq ($(PRINTSHAS),)
50 ubuntu_log_opts += --print-shas
51 endif
52
53 # Get the kernels own extra version to be added to the release signature.
54 extraversion=$(shell awk '/EXTRAVERSION =/ { print $$3 }' <Makefile)
55
56 #
57 # full_build -- are we doing a full buildd style build
58 #
59 ifeq ($(wildcard /CurrentlyBuilding),)
60 full_build?=false
61 else
62 full_build?=true
63 endif
64
65 #
66 # The debug packages are ginormous, so you probably want to skip
67 # building them (as a developer).
68 #
69 ifeq ($(full_build),false)
70 skipdbg=true
71 endif
72
73 abinum          := $(shell echo $(revision) | sed -e 's/\..*//')$(abi_suffix)
74 prev_abinum     := $(shell echo $(prev_revision) | sed -e 's/\..*//')$(abi_suffix)
75 abi_release     := $(release)-$(abinum)
76
77 uploadnum       := $(shell echo $(revision) | sed -e 's/.*\.//')
78 ifneq ($(full_build),false)
79   uploadnum     := $(uploadnum)-Ubuntu
80 endif
81
82 # XXX: linux-libc-dev got bumped to -803.N inadvertantly by a ti-omap4 upload
83 #      shift our version higher for this package only.  Ensure this only
84 #      occurs for the v2.6.35 kernel so that we do not propogate this into
85 #      any other series.
86 raw_uploadnum   := $(shell echo $(revision) | sed -e 's/.*\.//')
87 libc_dev_version :=
88 ifeq ($(DEBIAN),debian.master)
89 ifeq ($(release),2.6.35)
90 libc_dev_version := -v$(release)-$(shell expr "$(abinum)" + 1000).$(raw_uploadnum)
91 endif
92 endif
93
94 # We force the sublevel to be exactly what we want. The actual source may
95 # be an in development git tree. We want to force it here instead of
96 # committing changes to the top level Makefile
97 SUBLEVEL        := $(shell echo $(release) | awk -F. '{print $$3}')
98
99 DEB_HOST_GNU_TYPE  = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
100 DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
101 DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
102 DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
103
104 #
105 # Detect invocations of the form 'fakeroot debian/rules binary arch=armel'
106 # within an x86'en schroot. This only gets you part of the way sicne the
107 # packaging phase fails, but you can at least compile the kernel quickly.
108 #
109 arch := $(DEB_HOST_ARCH)
110 ifneq ($(arch),$(DEB_HOST_ARCH))
111         ifeq ($(arch),armel)
112                 CROSS_COMPILE ?= arm-linux-gnueabi-
113         endif
114 endif
115
116 #
117 # Detect invocations of the form 'dpk-buildpackage -B -aarmel' within
118 # an x86'en schroot. This is the only way to build all of the packages
119 # (except for tools).
120 #
121 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
122         CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
123 endif
124
125 abidir          := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch)
126 prev_abidir     := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(prev_revision)/$(arch)
127 commonconfdir   := $(CURDIR)/$(DEBIAN)/config
128 archconfdir     := $(CURDIR)/$(DEBIAN)/config/$(arch)
129 sharedconfdir   := $(CURDIR)/debian.master/config
130 builddir        := $(CURDIR)/debian/build
131 stampdir        := $(CURDIR)/debian/stamps
132
133 #
134 # The binary package name always starts with linux-image-$KVER-$ABI.$UPLOAD_NUM. There
135 # are places that you'll find linux-image hard coded, but I guess thats OK since the
136 # assumption that the binary package always starts with linux-image will never change.
137 #
138 bin_pkg_name=linux-image-$(abi_release)
139 hdrs_pkg_name=linux-headers-$(abi_release)
140 #
141 # The generation of content in the doc package depends on both 'AUTOBUILD=' and
142 # 'do_doc_package_content=true'. There are usually build errors during the development
143 # cycle, so its OK to leave 'do_doc_package_content=false' until those build
144 # failures get sorted out. Finally, the doc package doesn't really need to be built
145 # for developer testing (its kind of slow), so only do it if on a buildd.
146 do_doc_package=true
147 do_doc_package_content=true
148 ifeq ($(full_build),false)
149 do_doc_package_content=false
150 endif
151 doc_pkg_name=$(src_pkg_name)-doc
152
153 #
154 # Similarly with the linux-source package, you need not build it as a developer. Its
155 # somewhat I/O intensive and utterly useless.
156 #
157 do_source_package=true
158 do_source_package_content=true
159 ifeq ($(full_build),false)
160 do_source_package_content=false
161 endif
162
163 # linux-libc-dev may not be needed, default to building it.
164 do_libc_dev_package=true
165
166 # common headers normally is built as an indep package, but may be arch
167 do_common_headers_indep=true
168
169 # add a 'full source' mode
170 do_full_source=false
171
172 # build tools
173 ifneq ($(wildcard $(CURDIR)/tools),)
174 do_tools?=true
175 else
176 do_tools?=false
177 endif
178 tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
179 tools_common_pkg_name=$(src_pkg_name)-tools-common
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
187 # Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
188 #
189 # These 2 environment variables set the -j value of the kernel build. For example,
190 # CONCURRENCY_LEVEL=16 fakeroot $(DEBIAN)/rules binary-debs
191 # or
192 # DEB_BUILD_OPTIONS=parallel=16 fakeroot $(DEBIAN)/rules binary-debs
193 #
194 # The default is to use the number of CPUs.
195 #
196 COMMA=,
197 DEB_BUILD_OPTIONS_PARA = $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
198 ifneq (,$(DEB_BUILD_OPTIONS_PARA))
199   CONCURRENCY_LEVEL := $(DEB_BUILD_OPTIONS_PARA)
200 endif
201
202 ifeq ($(CONCURRENCY_LEVEL),)
203   # Check the environment
204   CONCURRENCY_LEVEL := $(shell echo $$CONCURRENCY_LEVEL)
205   # No? Then build with the number of CPUs on the host.
206   ifeq ($(CONCURRENCY_LEVEL),)
207       CONCURRENCY_LEVEL := $(shell expr `getconf _NPROCESSORS_ONLN` \* 1)
208   endif
209   # Oh hell, give 'em one
210   ifeq ($(CONCURRENCY_LEVEL),)
211     CONCURRENCY_LEVEL := 1
212   endif
213 endif
214
215 conc_level              = -j$(CONCURRENCY_LEVEL)
216
217 # target_flavour is filled in for each step
218 kmake = make ARCH=$(build_arch) \
219         CROSS_COMPILE=$(CROSS_COMPILE) \
220         EXTRAVERSION=-$(abinum)-$(target_flavour) \
221         CONFIG_DEBUG_SECTION_MISMATCH=y SUBLEVEL=$(SUBLEVEL) \
222         KBUILD_BUILD_VERSION="$(uploadnum)" \
223         LOCALVERSION= localver-extra=
224 ifneq ($(LOCAL_ENV_CC),)
225 kmake += CC=$(LOCAL_ENV_CC) DISTCC_HOSTS=$(LOCAL_ENV_DISTCC_HOSTS)
226 endif
227