aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-12-29 11:37:16 +0100
committerMarc André Tanner <mat@brain-dump.org>2015-12-29 11:48:43 +0100
commitb3ed399f1cce511c5a21b08d2b0fffeb615a4333 (patch)
tree5512e41584cc6c5d5dc067dc4bb5836d350ea993 /Makefile
parent51736d5d4468330cb2ffe45bb6fdf1119786195c (diff)
downloadvis-b3ed399f1cce511c5a21b08d2b0fffeb615a4333.tar.gz
vis-b3ed399f1cce511c5a21b08d2b0fffeb615a4333.tar.xz
Clean up build system
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 16 insertions, 9 deletions
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 $@