X-Git-Url: https://git.distorted.org.uk/~mdw/tig/blobdiff_plain/738cb15a2f9326fa0c4c129d6b3a43774932a1b9..737856053db9065ab83e348b4885c479381845d2:/Makefile diff --git a/Makefile b/Makefile index f8e601d..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,12 +24,6 @@ DOCS_HTML = tig.1.html tigrc.5.html \ DOCS = $(DOCS_MAN) $(DOCS_HTML) \ manual.toc manual.pdf -ifneq (,$(wildcard .git)) -VERSION = $(shell git-describe) -WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) -CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' -endif - all: $(PROGS) all-debug: $(PROGS) all-debug: CFLAGS += $(DFLAGS) @@ -88,7 +91,7 @@ README.html: README asciidoc -b xhtml11 -d manpage $< %.1.xml : %.1.txt - asciidoc -b docbook -d manpage $< + asciidoc -b docbook -d manpage -aversion=$(VERSION) $< %.1 : %.1.xml xmlto -m manpage.xsl man $< @@ -97,7 +100,7 @@ README.html: README asciidoc -b xhtml11 -d manpage $< %.5.xml : %.5.txt - asciidoc -b docbook -d manpage $< + asciidoc -b docbook -d manpage -aversion=$(VERSION) $< %.5 : %.5.xml xmlto -m manpage.xsl man $<