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