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