From 737856053db9065ab83e348b4885c479381845d2 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Thu, 31 May 2007 10:46:20 +0200 Subject: [PATCH] Move "static" version info to VERSION file Cleanup dynamic version acquiring via git. --- Makefile | 18 ++++++++++-------- VERSION | 1 + tig.c | 8 ++++---- 3 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 VERSION diff --git a/Makefile b/Makefile index 5e96234..9f2d086 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,17 @@ mandir = $(prefix)/man docdir = $(prefix)/share/doc # DESTDIR= +# Get version either via git or from VERSION file +ifneq (,$(wildcard .git)) +GITDESC = $(subst tig-,,$(shell git describe)) +WTDIRTY = $(if $(shell git-diff-index HEAD 2>/dev/null),-dirty) +VERSION = $(GITDESC)$(WTDIRTY) +else +VERSION = $(shell test -f VERSION && cat VERSION || echo "unknown-version") +endif + LDLIBS = -lcurses -CFLAGS = -Wall -O2 +CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"' DFLAGS = -g -DDEBUG -Werror PROGS = tig DOCS_MAN = tig.1 tigrc.5 @@ -15,13 +24,6 @@ DOCS_HTML = tig.1.html tigrc.5.html \ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ manual.toc manual.pdf -ifneq (,$(wildcard .git)) -GITDESC = $(subst tig-,,$(shell git describe)) -WTDIRTY = $(if $(shell git-diff-index HEAD 2>/dev/null),-dirty) -VERSION = $(GITDESC)$(WTDIRTY) -CFLAGS += '-DVERSION="tig-$(VERSION)"' -endif - all: $(PROGS) all-debug: $(PROGS) all-debug: CFLAGS += $(DFLAGS) diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..2516930 --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.6.git diff --git a/tig.c b/tig.c index 888133e..e918fe6 100644 --- a/tig.c +++ b/tig.c @@ -11,8 +11,8 @@ * GNU General Public License for more details. */ -#ifndef VERSION -#define VERSION "tig-0.6.git" +#ifndef VERSION +#define VERSION "unknown-version" #endif #ifndef DEBUG @@ -384,7 +384,7 @@ get_request(const char *name) */ static const char usage[] = -VERSION " (" __DATE__ ")\n" +"tig " VERSION " (" __DATE__ ")\n" "\n" "Usage: tig [options]\n" " or: tig [options] [--] [git log options]\n" @@ -2240,7 +2240,7 @@ view_driver(struct view *view, enum request request) break; case REQ_SHOW_VERSION: - report("%s (built %s)", VERSION, __DATE__); + report("tig-%s (built %s)", VERSION, __DATE__); return TRUE; case REQ_SCREEN_RESIZE: -- 2.11.0