From b3ed399f1cce511c5a21b08d2b0fffeb615a4333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Tue, 29 Dec 2015 11:37:16 +0100 Subject: Clean up build system --- Makefile | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f247162..85fdb76 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,18 @@ include config.mk +# try to get a tag and hash first +GITHASH = $(shell git log -1 --format='%h' 2>/dev/null) +GITTAG = $(shell git describe --abbrev=0 --tags 2>/dev/null) +ifneq ($(GITTAG),) + # we have a tag and revcount from there + GITREVCOUNT = $(shell git rev-list --count ${GITTAG}.. 2>/dev/null) + VERSION = ${GITTAG}.r${GITREVCOUNT}.g${GITHASH} +else ifneq ($(GITHASH),) + # we have no tags in git, so just use revision count an hash for now + GITREVCOUNT = $(shell git rev-list --count HEAD) + VERSION = 0.r${GITREVCOUNT}.g${GITHASH} +endif + SRCDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) ALL = *.c *.h config.mk Makefile LICENSE README.md vis.1 @@ -56,12 +69,7 @@ clean: dist: clean @echo creating dist tarball - @mkdir -p vis-${VERSION} - @cp -R ${ALL} vis-${VERSION} - @rm -f vis-${VERSION}/config.h - @tar -cf vis-${VERSION}.tar vis-${VERSION} - @gzip vis-${VERSION}.tar - @rm -rf vis-${VERSION} + @git archive --prefix=vis-${VERSION}/ -o vis-${VERSION}.tar.gz HEAD install: vis @echo stripping executable @@ -85,9 +93,8 @@ uninstall: @rm -f ${DESTDIR}${PREFIX}/bin/vis @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 @rm -f ${DESTDIR}${MANPREFIX}/man1/vis.1 - -release: - @git archive --prefix=vis-$(RELEASE)/ -o vis-$(RELEASE).tar.gz $(RELEASE) + @echo removing support files from ${DESTDIR}${SHAREPREFIX} + @[ ! -z "${SHAREPREFIX}" ] && rm -rf ${DESTDIR}${SHAREPREFIX} dependency/sources: mkdir -p $@ -- cgit v1.2.3