[L/unstable 01/13] UBUNTU: [Packaging] mark phony targets

Masahiro Yamada masahiro.yamada at canonical.com
Mon Dec 5 08:56:07 UTC 2022


I added the .PHONY before each of the target rules.

If we add multiple phony targets to .PHONY in a single line,
as in debian/rules.d/0-common-vars.mk, it is difficult to parse
which target is missing the .PHONY marker.

Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
---
 debian/rules                     | 4 ++++
 debian/rules.d/1-maintainer.mk   | 8 +++++++-
 debian/rules.d/2-binary-arch.mk  | 9 +++++++++
 debian/rules.d/3-binary-indep.mk | 5 +++++
 4 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 3cb6e8f2ea89..b5358727a901 100755
--- a/debian/rules
+++ b/debian/rules
@@ -122,10 +122,13 @@ nvidia_desktop_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]
 nvidia_server_series=$(shell sed -n -e 's/^nvidia-graphics-drivers-\([0-9][0-9]*-server\) .*/\1/p' debian/dkms-versions)
 
 # Debian Build System targets
+.PHONY: binary
 binary: binary-indep binary-arch
 
+.PHONY: build
 build: build-arch build-indep
 
+.PHONY: clean
 clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.pem
 	dh_testdir
 	dh_testroot
@@ -152,6 +155,7 @@ clean: debian/control debian/canonical-certs.pem debian/canonical-revoked-certs.
 	rm -f $(DROOT)/control.stub $(DEBIAN)/control.stub
 	rm -f $(DROOT)/scripts/fix-filenames
 
+.PHONY: distclean
 distclean: clean
 	rm -rf $(DROOT)/control debian/changelog \
 		debian/control debian/control.stub debian/copyright \
diff --git a/debian/rules.d/1-maintainer.mk b/debian/rules.d/1-maintainer.mk
index bcc3e4db3645..f20409ce6a72 100644
--- a/debian/rules.d/1-maintainer.mk
+++ b/debian/rules.d/1-maintainer.mk
@@ -42,6 +42,7 @@ help:
 	@echo "                  : Use -jX for kernel compile"
 	@echo "  PRINTSHAS       : Include SHAs for commits in changelog"
 
+.PHONY: printdebian
 printdebian:
 	@echo "$(DEBIAN)"
 
@@ -60,7 +61,10 @@ migrateconfigs:
 	fi
 	rm -rf build
 
-updateconfigs defaultconfigs genconfigs listnewconfigs importconfigs:
+configs-targets := updateconfigs defaultconfigs genconfigs listnewconfigs importconfigs
+
+.PHONY: $(configs-targets)
+$(configs-targets):
 	dh_testdir;
 	if [ -e "$(DEBIAN)/config/config.common.ubuntu" ]; then \
 		conc_level=$(conc_level) $(SHELL) $(DROOT)/scripts/misc/old-kernelconfig $@; \
@@ -189,11 +193,13 @@ startnewrelease:
 	cat $(DEBIAN)/changelog >> $(DEBIAN)/changelog.new; \
 	mv $(DEBIAN)/changelog.new $(DEBIAN)/changelog
 
+.PHONY: compileselftests
 compileselftests:
 	# a loop is needed here to fail on errors
 	for test in $(ubuntu_selftests); do \
 		$(kmake) -C tools/testing/selftests TARGETS="$$test"; \
 	done;
 
+.PHONY: runselftests
 runselftests:
 	$(kmake) -C tools/testing/selftests TARGETS="$(ubuntu_selftests)" run_tests
diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
index 1ea051e9b5e7..9d2ded9cdee1 100644
--- a/debian/rules.d/2-binary-arch.mk
+++ b/debian/rules.d/2-binary-arch.mk
@@ -545,6 +545,7 @@ hmake := $(MAKE) -C $(CURDIR) O=$(headers_tmp) \
 	KERNELVERSION=$(abi_release) INSTALL_HDR_PATH=$(headers_tmp)/install \
 	SHELL="$(SHELL)" ARCH=$(header_arch)
 
+.PHONY: install-arch-headers
 install-arch-headers:
 	@echo Debug: $@
 	dh_testdir
@@ -593,6 +594,7 @@ define dh_all_inline
         $(subst ${newline},; \${newline},$(call dh_all,$(1),$(2)))
 endef
 
+.PHONY: binary-arch-headers
 binary-arch-headers: install-arch-headers
 	@echo Debug: $@
 	dh_testdir
@@ -757,6 +759,7 @@ endif
 endif
 	@touch $@
 
+.PHONY: install-perarch
 install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
 install-perarch: cloudpkgdir = $(CURDIR)/debian/$(cloud_pkg_name)
 install-perarch: $(stampdir)/stamp-build-perarch
@@ -814,6 +817,7 @@ ifeq ($(do_tools_hyperv),true)
 endif
 endif
 
+.PHONY: binary-perarch
 binary-perarch: toolspkg = $(tools_pkg_name)
 binary-perarch: cloudpkg = $(cloud_pkg_name)
 binary-perarch: install-perarch
@@ -825,6 +829,7 @@ ifeq ($(do_cloud_tools),true)
 	$(call dh_all,$(cloudpkg))
 endif
 
+.PHONY: binary-debs
 binary-debs: signing = $(CURDIR)/debian/$(bin_pkg_name)-signing
 binary-debs: signingv = $(CURDIR)/debian/$(bin_pkg_name)-signing/$(release)-$(revision)
 binary-debs: signing_tar = $(src_pkg_name)_$(release)-$(revision)_$(arch).tar.gz
@@ -838,6 +843,8 @@ ifeq ($(any_signed),true)
 endif
 
 build-arch-deps-$(do_flavour_image_package) += $(addprefix $(stampdir)/stamp-install-,$(flavours))
+
+.PHONY: build-arch
 build-arch: $(build-arch-deps-true)
 	@echo Debug: $@
 
@@ -850,6 +857,8 @@ binary-arch-deps-$(do_libc_dev_package) += binary-arch-headers
 ifneq ($(do_common_headers_indep),true)
 binary-arch-deps-$(do_flavour_header_package) += binary-headers
 endif
+
+.PHONY: binary-arch
 binary-arch: $(binary-arch-deps-true)
 	@echo Debug: $@
 
diff --git a/debian/rules.d/3-binary-indep.mk b/debian/rules.d/3-binary-indep.mk
index 95ad7056459b..520a6c03bbe7 100644
--- a/debian/rules.d/3-binary-indep.mk
+++ b/debian/rules.d/3-binary-indep.mk
@@ -1,3 +1,4 @@
+.PHONY: build-indep
 build-indep:
 	@echo Debug: $@
 
@@ -29,6 +30,7 @@ endif
 
 docpkg = $(doc_pkg_name)
 docdir = $(CURDIR)/debian/$(docpkg)/usr/share/doc/$(docpkg)
+.PHONY: install-doc
 install-doc: $(stampdir)/stamp-prepare-indep
 	@echo Debug: $@
 ifeq ($(do_doc_package),true)
@@ -81,6 +83,7 @@ ifeq ($(do_source_package_content),true)
 endif
 endif
 
+.PHONY: install-tools
 install-tools: toolspkg = $(tools_common_pkg_name)
 install-tools: toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
 install-tools: toolssbin = $(CURDIR)/debian/$(toolspkg)/usr/sbin
@@ -177,11 +180,13 @@ $(stampdir)/stamp-prepare-indep:
 	dh_prep -i
 	@touch $@
 
+.PHONY: install-indep
 install-indep: $(stampdir)/stamp-install-headers install-doc install-source install-tools
 	@echo Debug: $@
 
 # This is just to make it easy to call manually. Normally done in
 # binary-indep target during builds.
+.PHONY: binary-headers
 binary-headers: $(stampdir)/stamp-prepare-indep $(stampdir)/stamp-install-headers
 	@echo Debug: $@
 	dh_installchangelogs -p$(indep_hdrpkg)
-- 
2.34.1




More information about the kernel-team mailing list