From d803fad133e882e29bc2069bde906f081ed8e34b Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Mon, 25 Nov 2013 23:37:37 +0200 Subject: [PATCH] Makefile: new 'make-dist' target Creates a tar.gz: * Identical results to the existing distributed tarballs * Named "dahdi-linux-.tar.gz" * Only from committed files (uses git-archive) * Adds a .version file Signed-off-by: Tzafrir Cohen Acked-by: Russ Meyerriecks --- Makefile | 5 ++++- build_tools/make_dist | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100755 build_tools/make_dist diff --git a/Makefile b/Makefile index a005ed1..1cf2ccd 100644 --- a/Makefile +++ b/Makefile @@ -169,6 +169,9 @@ update: echo "Not under version control"; \ fi +dist: + @./build_tools/make_dist "dahdi-linux" "$(DAHDIVERSION)" + clean: ifneq (no,$(HAS_KSRC)) $(KMAKE) clean @@ -198,6 +201,6 @@ README.html: README dahdi-api.html: drivers/dahdi/dahdi-base.c build_tools/kernel-doc --kernel $(KSRC) $^ >$@ -.PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm firmware-loaders +.PHONY: distclean dist-clean clean all install devices modules stackcheck install-udev update install-modules install-include uninstall-modules firmware-download install-xpp-firm firmware-loaders dist FORCE: diff --git a/build_tools/make_dist b/build_tools/make_dist new file mode 100755 index 0000000..6c9d453 --- /dev/null +++ b/build_tools/make_dist @@ -0,0 +1,26 @@ +#! /bin/sh + +if [ "$#" -ne 2 ]; then + echo >&2 "Usage: $0 " + exit 1 +fi +package="$1" +version="$2" +tarball_prefix="$package-$version" +echo "I: Making dist tarball for $tarball_prefix" +tarball_name="$tarball_prefix.tar.gz" + +tmp_work_dir=".tmp" +tmp_version_dir="$tmp_work_dir/$tarball_prefix" + +if [ "$DESTDIR" != '' ]; then + destdir="$DESTDIR/" +fi +output="$destdir$tarball_name" + +mkdir -p "$tmp_version_dir" +git archive --format tar HEAD | tar xf - -C "$tmp_version_dir" +echo "$version" > "$tmp_version_dir/.version" +tar czf "$output" -C "$tmp_work_dir" "$tarball_prefix" +rm -rf "$tmp_work_dir" +echo "I: tarball is ready: '$output'"