Browse code

makefile: better "dirty" local copy detection

Better detection for local changes, when re-generating autover.h.

Andrei Pelinescu-Onciul authored on 25/06/2009 10:56:06
Showing 1 changed files
... ...
@@ -458,9 +458,11 @@ ifneq ($(wildcard .git),)
458 458
 # if .git/ exists
459 459
 repo_ver=$(shell  RV=`git rev-parse --verify --short=6 HEAD 2>/dev/null`;\
460 460
 					[ -n "$$RV" ] && \
461
-					test -n "`git diff-index --name-only HEAD >/dev/null`" && \
461
+					test -n "`git update-index --refresh --unmerged >/dev/null\
462
+							; git diff-index --name-only HEAD 2>/dev/null | \
463
+								grep -v Makefile`" &&\
462 464
 						RV="$$RV"-dirty; echo "$$RV")
463
-autover_h_dep=.git
465
+autover_h_dep=.git $(filter-out $(auto_gen), $(sources)) cfg.y cfg.lex
464 466
 else
465 467
 # else if .git/ does not exist
466 468
 repo_ver=
... ...
@@ -469,7 +471,7 @@ endif
469 469
 
470 470
 
471 471
 autover.h: $(autover_h_dep)
472
-	@echo  "generating autover.h ($(autover_h_dep)) ..."
472
+	@echo  "generating autover.h ..."
473 473
 	@echo "/* this file is autogenerated by make autover.h" >$@
474 474
 	@echo " * DO NOT EDIT IT" >>$@
475 475
 	@echo " */" >>$@