From 400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 19 Apr 2013 11:57:02 +0100 Subject: Add a dist target to generate source distribution tarballs from the most recent git tag --- makefiles/Makefile.top | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'makefiles') 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) -- cgit v1.2.3