summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2023-02-15 02:20:28 +0100
committerMasahiro Yamada <masahiroy@kernel.org>2023-02-26 07:20:38 +0100
commitb44aa8c96e9eea54a42c074c278a8e05e1c231d5 (patch)
treef5735b1829fc16b1301469330814240ca282a198 /scripts
parentkbuild: deb-pkg: hide KDEB_SOURCENAME from Makefile (diff)
downloadlinux-b44aa8c96e9eea54a42c074c278a8e05e1c231d5.tar.xz
linux-b44aa8c96e9eea54a42c074c278a8e05e1c231d5.zip
kbuild: deb-pkg: make .orig tarball a hard link if possible
If '..' belongs to the same filesystem, create a hard link instead of a copy. In most cases, you can save disk space. I do not want to use 'mv' because keeping linux.tar.gz is useful to avoid unneeded rebuilding of the tarball. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.package6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index c207f4ec47ac..80a96eb61426 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -96,7 +96,11 @@ debian-orig: private source = $(shell dpkg-parsechangelog -S Source)
debian-orig: private version = $(shell dpkg-parsechangelog -S Version | sed 's/-[^-]*$$//')
debian-orig: private orig-name = $(source)_$(version).orig.tar.gz
debian-orig: linux.tar.gz debian
- $(Q)cp $< ../$(orig-name)
+ $(Q)if [ "$(df --output=target .. 2>/dev/null)" = "$(df --output=target $< 2>/dev/null)" ]; then \
+ ln -f $< ../$(orig-name); \
+ else \
+ cp $< ../$(orig-name); \
+ fi
PHONY += deb-pkg
deb-pkg: debian-orig