diff options
Diffstat (limited to 'makefiles/Makefile.top')
-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) |