3 # $(DEBIAN)/rules for Ubuntu linux
5 # Use this however you want, just give credit where credit is due.
7 # Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
10 DEBIAN
=$(shell awk
-F
= '($$1 == "DEBIAN") { print $$2 }' <debian
/debian.env
)
12 # dpkg-buildpackage passes options that are incomptatible
13 # with the kernel build.
18 export SHELL
=/bin
/bash
-e
20 # Where do we find the common configuration.
23 # Common variables for all architectures
24 include $(DROOT
)/rules.d
/0-common-vars.mk
26 # Pull in some arch specific stuff
27 -include $(DEBIAN
)/rules.d
/$(arch
).mk
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
34 include $(DROOT
)/rules.d
/1-maintainer.mk
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
)))
40 # Don't build tools or udebs in a cross compile environment.
41 ifneq ($(DEB_HOST_ARCH
),$(DEB_BUILD_ARCH
))
47 # Stages -- support both DEB_STAGE=stage1 and DEB_BUILD_PROFILE=bootstrap
48 ifeq ($(DEB_STAGE
),stage1
)
49 DEB_BUILD_PROFILES
=stage1
51 ifneq ($(DEB_BUILD_PROFILE
),)
52 DEB_BUILD_PROFILES
=$(DEB_BUILD_PROFILE
)
54 ifneq ($(filter stage1
,$(DEB_BUILD_PROFILES
)),)
57 do_source_package
=false
58 do_flavour_image_package
=false
59 do_flavour_header_package
=false
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
70 # Disable tools build and packaging if do_tools != true
71 ifneq ($(do_tools
),true
)
79 ifeq ($(do_zfs
),false
)
80 do_zfs_disable
:=$(shell cat
$(DROOT
)/zfs-modules.ignore
>>$(prev_abidir
)/..
/modules.ignore
)
83 # Either tools package needs the common source preparation
84 do_any_tools
=$(sort $(filter-out false
,$(do_linux_tools
) $(do_cloud_tools
)))
86 # autopkgtest -- rebuild support
87 # only build the first flavour on the assumption it is representative
88 ifneq ($(filter autopkgtest
,$(DEB_BUILD_PROFILES
)),)
89 flavours
:= $(firstword $(flavours
))
93 # Debian Build System targets
94 binary
: binary-indep binary-arch
96 build
: build-arch build-indep
104 rm -rf
$(DEBIAN
)/d-i-
$(arch
)
105 # Generated on the fly.
106 rm -f
$(DEBIAN
)/d-i
/firmware
/$(arch
)/kernel-image
109 rm -rf
$(DEBIAN
)/abi
/$(release
)-$(revision
)
111 rm -f
$(stampdir
)/stamp-
*
112 rm -rf
$(DEBIAN
)/linux-
*
114 # This gets rid of the d-i packages in control
115 cp
-f
$(DEBIAN
)/control.stub
$(DROOT
)/control
116 cp
$(DEBIAN
)/changelog debian
/changelog
118 # Install the copyright information.
119 cp
$(DEBIAN
)/copyright debian
/copyright
121 # If we have a reconstruct script use it.
122 [ -f
$(DEBIAN
)/reconstruct
] && bash
$(DEBIAN
)/reconstruct
124 # Remove generated intermediate files
125 rm -f
$(DROOT
)/control.stub
$(DEBIAN
)/control.stub
128 rm -rf
$(DROOT
)/control debian
/changelog \
129 debian
/control debian
/control.stub debian
/copyright
131 # Builds the image, arch headers and debug packages
132 include $(DROOT
)/rules.d
/2-binary-arch.mk
134 # Rules for building the udebs ($(DEBIAN)-installer)
135 include $(DROOT
)/rules.d
/5-udebs.mk
137 # Builds the source, doc and linux-headers indep packages
138 include $(DROOT
)/rules.d
/3-binary-indep.mk
140 # Various checks to be performed on builds
141 include $(DROOT
)/rules.d
/4-checks.mk
144 .PHONY
: $(DEBIAN
)/control.stub
145 $(DEBIAN
)/control.stub
: \
146 $(DROOT
)/scripts
/control-create \
147 $(DEBIAN
)/control.stub.in \
148 $(DEBIAN
)/changelog \
149 $(wildcard $(DEBIAN
)/control.d
/* $(DEBIAN
)/sub-flavours
/*.vars
)
150 for i in
$(DEBIAN
)/control.stub.in
; do \
151 new
=`echo $$i | sed 's/\.in$$//'`; \
152 cat
$$i | sed
-e
's/PKGVER/$(release)/g' \
153 -e
's/ABINUM/$(abinum)/g' \
154 -e
's/SRCPKGNAME/$(src_pkg_name)/g' \
155 -e
's/=HUMAN=/$(human_arch)/g' \
158 flavours
="$(sort $(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars))";\
159 for i in
$$flavours; do \
160 $(SHELL
) $(DROOT
)/scripts
/control-create
$$i | \
161 sed
-e
's/PKGVER/$(release)/g' \
162 -e
's/ABINUM/$(abinum)/g' \
163 -e
's/SRCPKGNAME/$(src_pkg_name)/g' \
164 -e
's/=HUMAN=/$(human_arch)/g' \
165 >> $(DEBIAN
)/control.stub
; \
168 .PHONY
: debian
/control
169 debian
/control
: $(DEBIAN
)/control.stub
170 echo
"# placebo control.stub for kernel-wedge flow change" >debian
/control.stub
171 cp
$(DEBIAN
)/control.stub debian
/control
172 export KW_DEFCONFIG_DIR
=$(DEBIAN
)/d-i
&& \
173 export KW_CONFIG_DIR
=$(DEBIAN
)/d-i
&& \
174 LANG
=C kernel-wedge gen-control
$(release
)-$(abinum
) | \
175 perl
-f
$(DROOT
)/scripts
/misc
/kernel-wedge-arch.pl
$(arch
) \
176 >>$(CURDIR
)/debian
/control