]>
Commit | Line | Data |
---|---|---|
356bd1e1 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 | ||
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 | ||
ed3e21fd AW |
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 | ||
356bd1e1 LO |
33 | # Maintainer targets |
34 | include $(DROOT)/rules.d/1-maintainer.mk | |
35 | ||
e66f5b2a | 36 | do_linux_tools=$(sort $(filter-out false,$(do_tools_usbip) $(do_tools_cpupower) $(do_tools_perf) $(do_tools_x86))) |
d974f731 | 37 | do_cloud_tools=$(sort $(filter-out false,$(do_tools_hyperv))) |
672acb1b | 38 | do_tools_common=true |
d974f731 | 39 | |
e3ffb16b | 40 | # Don't build tools or udebs in a cross compile environment. |
1154d441 | 41 | ifneq ($(DEB_HOST_ARCH),$(DEB_BUILD_ARCH)) |
d974f731 | 42 | do_tools=false |
e3ffb16b | 43 | disable_d_i=true |
ee40c53e | 44 | do_zfs=false |
16674aa6 | 45 | do_zfs_disable:=$(shell cat $(DROOT)/zfs-modules.ignore >>$(prev_abidir)/../modules.ignore) |
d974f731 TG |
46 | endif |
47 | ||
d3d25a07 | 48 | # Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap |
356bd1e1 | 49 | ifeq ($(DEB_STAGE),stage1) |
d9941c2b | 50 | DEB_BUILD_PROFILES=stage1 |
d3d25a07 | 51 | endif |
af1c8d31 AW |
52 | ifneq ($(DEB_BUILD_PROFILE),) |
53 | DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILE) | |
54 | endif | |
d9941c2b | 55 | ifneq ($(filter stage1,$(DEB_BUILD_PROFILES)),) |
356bd1e1 LO |
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 | ||
dbbf86d5 AW |
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 | ||
aa3f30c9 TG |
71 | # Disable tools build and packaging if do_tools != true |
72 | ifneq ($(do_tools),true) | |
73 | do_linux_tools= | |
74 | do_cloud_tools= | |
288ce282 | 75 | do_tools_common= |
aa3f30c9 TG |
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 | ||
206bb875 SF |
81 | # Temporarily disable ZFS during the early -rc releases. |
82 | do_zfs=false | |
83 | ||
bcbac363 AW |
84 | # autopkgtest -- rebuild support |
85 | # only build the first flavour on the assumption it is representative | |
86 | ifeq ($(DEB_BUILD_PROFILE),autopkgtest) | |
87 | flavours := $(firstword $(flavours)) | |
88 | endif | |
89 | ||
356bd1e1 LO |
90 | # Debian Build System targets |
91 | binary: binary-indep binary-arch | |
92 | ||
93 | build: build-arch build-indep | |
94 | ||
95 | clean: debian/control | |
96 | dh_testdir | |
97 | dh_testroot | |
98 | dh_clean | |
99 | ||
100 | # d-i stuff | |
101 | rm -rf $(DEBIAN)/d-i-$(arch) | |
b3dd6088 | 102 | # Generated on the fly. |
528efac0 | 103 | rm -f $(DEBIAN)/d-i/firmware/$(arch)/kernel-image |
356bd1e1 LO |
104 | |
105 | # normal build junk | |
106 | rm -rf $(DEBIAN)/abi/$(release)-$(revision) | |
107 | rm -rf $(builddir) | |
108 | rm -f $(stampdir)/stamp-* | |
109 | rm -rf $(DEBIAN)/linux-* | |
110 | ||
111 | # This gets rid of the d-i packages in control | |
db36a33b | 112 | cp -f $(DEBIAN)/control.stub $(DROOT)/control |
356bd1e1 LO |
113 | cp $(DEBIAN)/changelog debian/changelog |
114 | ||
115 | # Install the copyright information. | |
116 | cp $(DEBIAN)/copyright debian/copyright | |
117 | ||
34010af2 | 118 | # If we have a reconstruct script use it. |
02522df3 | 119 | [ -f $(DEBIAN)/reconstruct ] && bash $(DEBIAN)/reconstruct |
34010af2 | 120 | |
a6415f25 | 121 | # Remove generated intermediate files |
3a16818c | 122 | rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub |
a6415f25 | 123 | |
356bd1e1 | 124 | distclean: clean |
a6415f25 | 125 | rm -rf $(DROOT)/control debian/changelog \ |
356bd1e1 LO |
126 | debian/control debian/control.stub debian/copyright |
127 | ||
128 | # Builds the image, arch headers and debug packages | |
129 | include $(DROOT)/rules.d/2-binary-arch.mk | |
130 | ||
131 | # Rules for building the udebs ($(DEBIAN)-installer) | |
132 | include $(DROOT)/rules.d/5-udebs.mk | |
133 | ||
134 | # Builds the source, doc and linux-headers indep packages | |
135 | include $(DROOT)/rules.d/3-binary-indep.mk | |
136 | ||
137 | # Various checks to be performed on builds | |
138 | include $(DROOT)/rules.d/4-checks.mk | |
139 | ||
140 | # Misc stuff | |
141 | .PHONY: $(DEBIAN)/control.stub | |
3a16818c | 142 | $(DEBIAN)/control.stub: \ |
356bd1e1 LO |
143 | $(DROOT)/scripts/control-create \ |
144 | $(DEBIAN)/control.stub.in \ | |
145 | $(DEBIAN)/changelog \ | |
146 | $(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars) | |
3a16818c | 147 | for i in $(DEBIAN)/control.stub.in; do \ |
356bd1e1 LO |
148 | new=`echo $$i | sed 's/\.in$$//'`; \ |
149 | cat $$i | sed -e 's/PKGVER/$(release)/g' \ | |
150 | -e 's/ABINUM/$(abinum)/g' \ | |
151 | -e 's/SRCPKGNAME/$(src_pkg_name)/g' \ | |
152 | -e 's/=HUMAN=/$(human_arch)/g' \ | |
153 | > $$new; \ | |
154 | done | |
adf41842 | 155 | flavours="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\ |
356bd1e1 LO |
156 | for i in $$flavours; do \ |
157 | $(SHELL) $(DROOT)/scripts/control-create $$i | \ | |
158 | sed -e 's/PKGVER/$(release)/g' \ | |
159 | -e 's/ABINUM/$(abinum)/g' \ | |
160 | -e 's/SRCPKGNAME/$(src_pkg_name)/g' \ | |
161 | -e 's/=HUMAN=/$(human_arch)/g' \ | |
162 | >> $(DEBIAN)/control.stub; \ | |
163 | done | |
356bd1e1 LO |
164 | |
165 | .PHONY: debian/control | |
166 | debian/control: $(DEBIAN)/control.stub | |
db36a33b AW |
167 | echo "# placebo control.stub for kernel-wedge flow change" >debian/control.stub |
168 | cp $(DEBIAN)/control.stub debian/control | |
57705577 AW |
169 | export KW_DEFCONFIG_DIR=$(DEBIAN)/d-i && \ |
170 | export KW_CONFIG_DIR=$(DEBIAN)/d-i && \ | |
3a16818c | 171 | LANG=C kernel-wedge gen-control $(release)-$(abinum) | \ |
57705577 AW |
172 | perl -f $(DROOT)/scripts/misc/kernel-wedge-arch.pl $(arch) \ |
173 | >>$(CURDIR)/debian/control |