]> git.itanic.dy.fi Git - linux-stable/blob - scripts/package/debian/rules
0ffa806bbd7896db99056856822cbcc7e84cf112
[linux-stable] / scripts / package / debian / rules
1 #!/usr/bin/make -f
2 # SPDX-License-Identifier: GPL-2.0-only
3
4 include debian/rules.vars
5
6 ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
7     NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
8     MAKEFLAGS += -j$(NUMJOBS)
9 endif
10
11 revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version)))
12 CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-)
13 make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE))
14
15 .PHONY: binary binary-indep binary-arch
16 binary: binary-arch binary-indep
17 binary-indep: build-indep
18 binary-arch: build-arch
19         $(MAKE) $(make-opts) \
20         run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb'
21
22 .PHONY: build build-indep build-arch
23 build: build-arch build-indep
24 build-indep:
25 build-arch:
26         $(MAKE) $(make-opts) \
27         olddefconfig all
28
29 .PHONY: clean
30 clean:
31         rm -rf debian/files debian/linux-* debian/deb-env.vars*
32         $(MAKE) ARCH=$(ARCH) clean
33
34 # If DEB_HOST_ARCH is empty, it is likely that debian/rules was executed
35 # directly. Run 'dpkg-architecture --print-set --print-format=make' to
36 # generate a makefile construct that exports all DEB_* variables.
37 ifndef DEB_HOST_ARCH
38 include debian/deb-env.vars
39
40 debian/deb-env.vars:
41         dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp
42         mv $@.tmp $@
43 endif