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