diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2023-02-15 10:20:31 +0900 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2023-02-26 15:23:30 +0900 |
commit | 1fc9095846cc0b7a4d027da2d0bd7569914bf129 (patch) | |
tree | 04b6a44f74a57c545f8d5197042f2d739ad28014 /scripts | |
parent | e0ca16749ac3392a5a2ea4e67327fa71ef4aa680 (diff) | |
download | linux-1fc9095846cc0b7a4d027da2d0bd7569914bf129.tar.gz linux-1fc9095846cc0b7a4d027da2d0bd7569914bf129.tar.bz2 linux-1fc9095846cc0b7a4d027da2d0bd7569914bf129.zip |
kbuild: tar-pkg: use tar rules in scripts/Makefile.package
Use %.tar, %.tar.gz, %.tar.bz2, %.tar.xz, %.tar.zst rules in
scripts/Makefile.package.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.package | 29 | ||||
-rwxr-xr-x | scripts/package/buildtar | 52 |
2 files changed, 24 insertions, 57 deletions
diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 50b86b325d7a..b941e6341b36 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -145,13 +145,30 @@ snap-pkg: cd $(objtree)/snap && \ snapcraft --target-arch=$(UTS_MACHINE) -# tarball targets +# dir-pkg tar*-pkg - tarball targets # --------------------------------------------------------------------------- -tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg tarzst-pkg -PHONY += $(tar-pkgs) -$(tar-pkgs): - $(MAKE) -f $(srctree)/Makefile - +$(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ + +tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1) +tar-pkg-phony = $(subst .,,$(1))-pkg + +tar-install: FORCE + $(Q)$(MAKE) -f $(srctree)/Makefile + +$(Q)$(srctree)/scripts/package/buildtar $@ + +PHONY += dir-pkg +dir-pkg: tar-install + @echo "Kernel tree successfully created in $<" + +define tar-pkg-rule +PHONY += $(tar-pkg-phony) +$(tar-pkg-phony): $(tar-pkg-tarball) + @: + +$(tar-pkg-tarball): private tar-rootdir := tar-install +$(tar-pkg-tarball): tar-install +endef + +$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x)))) # perf-tar*-src-pkg - generate a source tarball with perf source # --------------------------------------------------------------------------- diff --git a/scripts/package/buildtar b/scripts/package/buildtar index 4d6f0b128efd..65b4ea502962 100755 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar @@ -16,39 +16,7 @@ set -e # # Some variables and settings used throughout the script # -tmpdir="${objtree}/tar-install" -tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar" - - -# -# Figure out how to compress, if requested at all -# -case "${1}" in - dir-pkg|tar-pkg) - opts= - ;; - targz-pkg) - opts="-I ${KGZIP}" - tarball=${tarball}.gz - ;; - tarbz2-pkg) - opts="-I ${KBZIP2}" - tarball=${tarball}.bz2 - ;; - tarxz-pkg) - opts="-I ${XZ}" - tarball=${tarball}.xz - ;; - tarzst-pkg) - opts="-I ${ZSTD}" - tarball=${tarball}.zst - ;; - *) - echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 - exit 1 - ;; -esac - +tmpdir=$1 # # Clean-up and re-create the temporary directory @@ -148,21 +116,3 @@ case "${ARCH}" in sleep 5 ;; esac - -if [ "${1}" = dir-pkg ]; then - echo "Kernel tree successfully created in $tmpdir" - exit 0 -fi - -# -# Create the tarball -# -if tar --owner=root --group=root --help >/dev/null 2>&1; then - opts="$opts --owner=root --group=root" -fi - -tar cf $tarball -C $tmpdir $opts $dirs - -echo "Tarball successfully created in $tarball" - -exit 0 |