make: Add tarball target

Submitted by Cyrill Gorcunov on Oct. 10, 2017, 10:03 p.m.

Details

Message ID 1507672982-25669-1-git-send-email-gorcunov@openvz.org
State New
Series "make: Add tarball target"
Headers show

Commit Message

Cyrill Gorcunov Oct. 10, 2017, 10:03 p.m.
From: Cyrill Gorcunov <gorcunov@virtuozzo.com>

Sometimes for debug sake we need to build criu from source,
and setting up git on the target machine is not an option,
or due to network slow connection it takes too much time
to upload the whole history. Just pack current HEAD into
a tarball.

Signed-off-by: Cyrill Gorcunov <gorcunov@virtuozzo.com>
---
 Makefile | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index 796cad874da2..5d1d732ecbcd 100644
--- a/Makefile
+++ b/Makefile
@@ -310,6 +310,14 @@  tar-name := $(shell echo $(head-name) | sed -e 's/^v//g')
 dist tar: criu-$(tar-name).tar.bz2 ;
 .PHONY: dist tar
 
+ifeq ($(filter-out tarball,$(MAKECMDGOALS)),)
+tarball-prefix := $(shell git describe --always --long)
+tarball-file := criu-$(tarball-prefix).tar.bz2
+endif
+tarball:
+	git archive --format tar --prefix 'criu-$(tarball-prefix)/' HEAD | bzip2 > $(tarball-file)
+.PHONY: tarball
+
 TAGS_FILES_REGEXP := . -name '*.[hcS]' ! -path './.*' \( ! -path './test/*' -o -path './test/zdtm/lib/*' \)
 tags:
 	$(call msg-gen, $@)
@@ -356,6 +364,7 @@  TAGS_FILES_REGEXP := . -name '*.[hcS]' ! -path './.*' \( ! -path './test/*' -o -
 	@echo '      install         - Install CRIU (see INSTALL.md)'
 	@echo '      uninstall       - Uninstall CRIU'
 	@echo '      dist            - Create a source tarball'
+	@echo '      tarball         - Create a source tarball for current HEAD'
 	@echo '      clean           - Clean most, but leave enough to navigate'
 	@echo '      mrproper        - Delete all compiled/generated files'
 	@echo '      tags            - Generate tags file (ctags)'