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