Record builds with dirty working tree by appending -dirty to the version
[tig] / Makefile
index c1fd656..78d47a4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
 PREFIX = $(HOME)
 LDLIBS  = -lcurses
 CFLAGS = -Wall
-DFLAGS = -g -DDEBUG
+DFLAGS = -g -DDEBUG -Werror
 PROGS  = tig
 DOCS   = tig.1.txt tig.1.html tig.1 README.html
 
 ifneq (,$(wildcard .git))
-CFLAGS += '-DVERSION="$(shell git-describe)"'
+VERSION = $(shell git-describe)
+WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)
+CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"'
 endif
 
 all: $(PROGS)