1 #!/usr/bin/make -f 1 #!/usr/bin/make -f 2 # SPDX-License-Identifier: GPL-2.0-only 2 # SPDX-License-Identifier: GPL-2.0-only 3 3 4 # in case debian/rules is executed directly << 5 export DEB_RULES_REQUIRES_ROOT := no << 6 << 7 include debian/rules.vars 4 include debian/rules.vars 8 5 >> 6 srctree ?= . >> 7 9 ifneq (,$(filter-out parallel=1,$(filter paral 8 ifneq (,$(filter-out parallel=1,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))) 10 NUMJOBS = $(patsubst parallel=%,%,$(filter 9 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) 11 MAKEFLAGS += -j$(NUMJOBS) 10 MAKEFLAGS += -j$(NUMJOBS) 12 endif 11 endif 13 12 14 # When KBUILD_VERBOSE is undefined (presumably << 15 # the debianized tree), show verbose logs unle << 16 ifeq ($(origin KBUILD_VERBOSE),undefined) << 17 ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS) << 18 export KBUILD_VERBOSE := 1 << 19 else << 20 Q := @ << 21 endif << 22 endif << 23 << 24 revision = $(lastword $(subst -, ,$(shell dpkg << 25 CROSS_COMPILE ?= $(filter-out $(DEB_BUILD_GNU_ << 26 make-opts = ARCH=$(ARCH) KERNELRELEASE=$(KERNE << 27 << 28 binary-targets := $(addprefix binary-, image i << 29 << 30 all-packages = $(shell dh_listpackages) << 31 image-package = $(filter linux-image-% user-%, << 32 image-dbg-package = $(filter %-dbg, $(all-pack << 33 libc-dev-package = $(filter linux-libc-dev, $( << 34 headers-package = $(filter linux-headers-%, $( << 35 << 36 mk-files = $(patsubst binary-%,debian/%.files, << 37 package = $($(@:binary-%=%-package)) << 38 << 39 # DH_OPTION is an environment variable common << 40 # We could 'export' it, but here it is passed << 41 # which package is being processed in the buil << 42 DH_OPTIONS = -p$(package) << 43 << 44 define binary << 45 $(Q)dh_testdir $(DH_OPTIONS) << 46 $(Q)dh_testroot $(DH_OPTIONS) << 47 $(Q)dh_prep $(DH_OPTIONS) << 48 $(Q)+$(MAKE) $(make-opts) run-command << 49 $(Q)dh_installdocs $(DH_OPTIONS) << 50 $(Q)dh_installchangelogs $(DH_OPTIONS) << 51 $(Q)dh_compress $(DH_OPTIONS) << 52 $(Q)dh_fixperms $(DH_OPTIONS) << 53 $(Q)dh_gencontrol $(DH_OPTIONS) -- -f$ << 54 $(Q)dh_md5sums $(DH_OPTIONS) << 55 $(Q)dh_builddeb $(DH_OPTIONS) -- $(add << 56 endef << 57 << 58 .PHONY: $(binary-targets) << 59 $(binary-targets): build-arch << 60 $(Q)truncate -s0 $(call mk-files,$@) << 61 $(if $(package),$(binary)) << 62 << 63 .PHONY: binary binary-indep binary-arch 13 .PHONY: binary binary-indep binary-arch 64 binary: binary-arch binary-indep 14 binary: binary-arch binary-indep 65 binary-indep: build-indep 15 binary-indep: build-indep 66 binary-arch: $(binary-targets) !! 16 binary-arch: build-arch 67 $(Q)cat $(call mk-files,$^) > debian/f !! 17 $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) \ >> 18 KERNELRELEASE=$(KERNELRELEASE) \ >> 19 run-command KBUILD_RUN_COMMAND=+$(srctree)/scripts/package/builddeb 68 20 69 .PHONY: build build-indep build-arch 21 .PHONY: build build-indep build-arch 70 build: build-arch build-indep 22 build: build-arch build-indep 71 build-indep: 23 build-indep: 72 build-arch: 24 build-arch: 73 $(Q)$(MAKE) $(make-opts) olddefconfig !! 25 $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) \ 74 $(Q)$(MAKE) $(make-opts) $(if $(filter !! 26 KERNELRELEASE=$(KERNELRELEASE) \ >> 27 $(shell $(srctree)/scripts/package/deb-build-option) \ >> 28 olddefconfig all 75 29 76 .PHONY: clean 30 .PHONY: clean 77 clean: 31 clean: 78 $(Q)dh_clean !! 32 rm -rf debian/files debian/linux-* 79 $(Q)rm -rf debian/deb-env.vars* debian !! 33 $(MAKE) -f $(srctree)/Makefile ARCH=$(ARCH) clean 80 $(Q)$(MAKE) ARCH=$(ARCH) clean << 81 << 82 # If DEB_HOST_ARCH is empty, it is likely that << 83 # directly. Run 'dpkg-architecture --print-set << 84 # generate a makefile construct that exports a << 85 ifndef DEB_HOST_ARCH << 86 include debian/deb-env.vars << 87 << 88 debian/deb-env.vars: << 89 $(Q)dpkg-architecture -a$$(cat debian/ << 90 $(Q)mv $@.tmp $@ << 91 endif <<
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.