diff options
author | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2013-04-19 11:57:02 +0100 |
---|---|---|
committer | Vincent Sanders <vincent.sanders@collabora.co.uk> | 2013-04-19 11:57:02 +0100 |
commit | 400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68 (patch) | |
tree | b6f67c7971b8a4a4876486ee6e8efa8853f8a61a | |
parent | 5279a9d2421fd967eaf2094c69b197d24f48524f (diff) | |
download | buildsystem-400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68.tar.gz buildsystem-400dd74ad6f3d68ca07e61a8b3ade9e07ba2ba68.tar.bz2 |
Add a dist target to generate source distribution tarballs from the most recent git tag
-rw-r--r-- | makefiles/Makefile.top | 17 |
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) |