1#!/usr/bin/make -f 2# SPDX-License-Identifier: GPL-2.0-only 3 4include debian/rules.vars 5 6ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) 7 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 8 MAKEFLAGS += -j$(NUMJOBS) 9endif 10 11revision = $(lastword $(subst -, ,$(shell dpkg-parsechangelog -S Version))) 12CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_TYPE)-, $(DEB_HOST_GNU_TYPE)-) 13make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNELRELEASE) KBUILD_BUILD_VERSION=$(revision) $(addprefix CROSS_COMPILE=,$(CROSS_COMPILE)) 14 15.PHONY: binary binary-indep binary-arch 16binary: binary-arch binary-indep 17binary-indep: build-indep 18binary-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 23build: build-arch build-indep 24build-indep: 25build-arch: 26 $(MAKE) $(make-opts) \ 27 olddefconfig all 28 29.PHONY: clean 30clean: 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. 37ifndef DEB_HOST_ARCH 38include debian/deb-env.vars 39 40debian/deb-env.vars: 41 dpkg-architecture -a$$(cat debian/arch) --print-set --print-format=make > $@.tmp 42 mv $@.tmp $@ 43endif 44