2 # SPDX-License-Identifier: GPL-2.0-only
4 include debian/rules.vars
6 ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS))))
7 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
8 MAKEFLAGS += -j$(NUMJOBS)
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))
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'
22 .PHONY: build build-indep build-arch
23 build: build-arch build-indep
26 $(MAKE) $(make-opts) \
31 rm -rf debian/files debian/linux-* debian/deb-env.vars*
32 $(MAKE) ARCH=$(ARCH) clean
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.
38 include debian/deb-env.vars
41 dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp