]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - debian/rules
UBUNTU: [Packaging] retpoline -- add safe usage hint support
[mirror_ubuntu-artful-kernel.git] / debian / rules
CommitLineData
fef4fb4a
LO
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
10DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
11
12# dpkg-buildpackage passes options that are incomptatible
13# with the kernel build.
14unexport CFLAGS
15unexport LDFLAGS
16
17export LC_ALL=C
18export SHELL=/bin/bash -e
19
20# Where do we find the common configuration.
21export DROOT=debian
22
23# Common variables for all architectures
24include $(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
34include $(DROOT)/rules.d/1-maintainer.mk
35
36do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_x86)))
37do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv)))
35e505cc 38do_tools_common?=true
fef4fb4a
LO
39
40# Don't build tools or udebs in a cross compile environment.
41ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH))
42 do_tools=false
43 disable_d_i=true
44 do_zfs=false
fef4fb4a
LO
45endif
46
47# Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
48ifeq ($(DEB_STAGE),stage1)
49 DEB_BUILD_PROFILES=stage1
50endif
51ifneq ($(DEB_BUILD_PROFILE),)
52 DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE)
53endif
54ifneq ($(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
60endif
61
62# Being used to build a mainline build -- turn off things which do not work.
63ifeq ($(do_mainline_build),true)
64 do_extras_package=false
65 do_tools=false
66 no_dumpfile=1
67 do_zfs=false
ac692c71
AW
68 skipabi=true
69 skipmodule=true
70 skipretpoline=true
fef4fb4a
LO
71endif
72
73# Disable tools build and packaging if do_tools != true
74ifneq ($(do_tools),true)
75 do_linux_tools=
76 do_cloud_tools=
77 do_tools_common=
78endif
79
9b9414ed
AW
80ifeq ($(do_zfs),false)
81 do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore)
82endif
83
fef4fb4a
LO
84# Either tools package needs the common source preparation
85do_any_tools=$(sort $(filter-out false,$(do_linux_tools) $(do_cloud_tools)))
86
87# autopkgtest -- rebuild support
88# only build the first flavour on the assumption it is representative
6049dc32 89ifneq ($(filter autopkgtest,$(DEB_BUILD_PROFILES)),)
fef4fb4a 90flavours := $(firstword $(flavours))
06f9e146 91disable_d_i=true
fef4fb4a
LO
92endif
93
94# Debian Build System targets
95binary: binary-indep binary-arch
96
97build: build-arch build-indep
98
99clean: debian/control
100 dh_testdir
101 dh_testroot
102 dh_clean
103
104 # d-i stuff
105 rm -rf $(DEBIAN)/d-i-$(arch)
106 # Generated on the fly.
107 rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image
108
109 # normal build junk
110 rm -rf $(DEBIAN)/abi/$(release)-$(revision)
111 rm -rf $(builddir)
112 rm -f $(stampdir)/stamp-*
113 rm -rf $(DEBIAN)/linux-*
114
115 # This gets rid of the d-i packages in control
116 cp -f $(DEBIAN)/control.stub $(DROOT)/control
117 cp $(DEBIAN)/changelog debian/changelog
118
119 # Install the copyright information.
120 cp $(DEBIAN)/copyright debian/copyright
121
122 # If we have a reconstruct script use it.
123 [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct
124
125 # Remove generated intermediate files
126 rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
127
128distclean: clean
129 rm -rf $(DROOT)/control debian/changelog \
130 debian/control debian/control.stub debian/copyright
131
132# Builds the image, arch headers and debug packages
133include $(DROOT)/rules.d/2-binary-arch.mk
134
135# Rules for building the udebs ($(DEBIAN)-installer)
136include $(DROOT)/rules.d/5-udebs.mk
137
138# Builds the source, doc and linux-headers indep packages
139include $(DROOT)/rules.d/3-binary-indep.mk
140
141# Various checks to be performed on builds
142include $(DROOT)/rules.d/4-checks.mk
143
144# Misc stuff
145.PHONY: $(DEBIAN)/control.stub
146$(DEBIAN)/control.stub: \
147 $(DROOT)/scripts/control-create \
148 $(DEBIAN)/control.stub.in \
149 $(DEBIAN)/changelog \
150 $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
151 for i in $(DEBIAN)/control.stub.in; do \
152 new=`echo $$i | sed 's/\.in$$//'`; \
153 cat $$i | sed -e 's/PKGVER/$(release)/g' \
154 -e 's/ABINUM/$(abinum)/g' \
155 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
156 -e 's/=HUMAN=/$(human_arch)/g' \
157 > $$new; \
158 done
159 flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
160 for i in $$flavours; do \
161 $(SHELL) $(DROOT)/scripts/control-create $$i | \
162 sed -e 's/PKGVER/$(release)/g' \
163 -e 's/ABINUM/$(abinum)/g' \
164 -e 's/SRCPKGNAME/$(src_pkg_name)/g' \
165 -e 's/=HUMAN=/$(human_arch)/g' \
166 >> $(DEBIAN)/control.stub; \
167 done
168
169.PHONY: debian/control
170debian/control: $(DEBIAN)/control.stub
171 echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub
172 cp $(DEBIAN)/control.stub debian/control
173 export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \
174 export KW_CONFIG_DIR=$(DEBIAN)/d-i && \
175 LANG=C kernel-wedge gen-control $(release)-$(abinum) | \
176 perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \
177 >>$(CURDIR)/debian/control