summaryrefslogtreecommitdiff
path: root/makefiles
diff options
context:
space:
mode:
authorVincent Sanders <vincent.sanders@collabora.co.uk>2013-04-19 11:57:02 +0100
committerVincent Sanders <vincent.sanders@collabora.co.uk>2013-04-19 11:57:02 +0100
commit400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68 (patch)
treeb6f67c7971b8a4a4876486ee6e8efa8853f8a61a /makefiles
parent5279a9d2421fd967eaf2094c69b197d24f48524f (diff)
downloadbuildsystem-400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68.tar.gz
buildsystem-400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68.tar.bz2
Add a dist target to generate source distribution tarballs from the most recent git tag
Diffstat (limited to 'makefiles')
-rw-r--r--makefiles/Makefile.top17
1 files changed, 17 insertions, 0 deletions
diff --git a/makefiles/Makefile.top b/makefiles/Makefile.top
index bd7cddd..f9f21df 100644
--- a/makefiles/Makefile.top
+++ b/makefiles/Makefile.top
@@ -47,6 +47,7 @@
# coverage Determine test suite coverage (requires lcov)
# profile Build with profiling support enabled (requires gprof)
# docs Produce documentation (requires doxygen)
+# dist Produce release tarball from latest git tag
# clean Clean the build
# distclean Remove distribution files, too
# install Install component into prefix.
@@ -236,6 +237,22 @@ profile: __partial_clean test
docs: $(BUILDDIR)/stamp
$(Q)$(DOXYGEN) build/Doxyfile
+# Distribution
+# This constructs a distribution tar from the last git tag. It ensures
+# the Makefile component version matches the git tag version and the
+# tar is apropriately named for the component being generated
+dist:
+ $(eval GIT_TAG := $(shell git describe --abbrev=0 --match "v*"))
+ $(eval GIT_VER := $(shell x="$(GIT_TAG)"; echo "$${x#v}"))
+ $(if $(subst $(GIT_VER),,$(COMPONENT_VERSION)), $(error Component Version "$(COMPONENT_VERSION)" and GIT tag version "$(GIT_VER)" do not match))
+ifeq ($(findstring lib,$(COMPONENT_TYPE)),lib)
+ $(eval DIST_FILE := lib$(COMPONENT)-${GIT_VER})
+else
+ $(eval DIST_FILE := $(COMPONENT)-${GIT_VER})
+endif
+ $(Q)git archive --format=tar.gz --prefix=$(DIST_FILE)/ -o $(DIST_FILE).tar.gz $(GIT_TAG)
+
+
# Clean build tree
__partial_clean:
-$(Q)$(RM) $(RMFLAGS) $(CLEAN_ITEMS)