Module: sip-router
Branch: master
Commit: a868066e82310eef6f7e00d3b4e941ed50e7dc6f
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a868066…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Jun 24 22:25:33 2009 +0200
makefile: REPO_VER: try to detect dirty local repo
- add -dirty to the git sha if when autover.h is generated the local
repository contains locally modified files.
- make tar forces autover.h generation
---
Makefile | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 68eff8c..a37999b 100644
--- a/Makefile
+++ b/Makefile
@@ -62,6 +62,8 @@
# $(MAKE) invocation (andrei)
# 2009-04-22 don't rebuild config.mak or modules.lst if not needed
# (e.g. on clean) (andrei)
+# 2009-06-24 auto-generate autover.h, containing the REPO_VER macro, defined
+# to the top git commit sha (if git is found) (andrei)
#
# check make version
@@ -452,14 +454,18 @@ modules-cfg modules-list modules-lst:
ifneq ($(wildcard .git),)
# if .git/ exists
-repo_ver=$(shell git rev-parse --short=6 HEAD 2>/dev/null || echo "unknown"
)
+repo_ver=$(shell RV=`git rev-parse --verify --short=6 HEAD 2>/dev/null`;\
+ [ -n "$$RV" ] && \
+ test -n "`git diff-index --name-only HEAD >/dev/null`" && \
+ RV="$$RV"-dirty; echo "$$RV")
autover_h_dep=.git
else
# else if .git/ does not exist
-repo_ver="unknown"
+repo_ver=
autover_h_dep=
endif
+
autover.h: $(autover_h_dep)
@echo "generating autover.h ($(autover_h_dep)) ..."
@echo "/* this file is autogenerated by make autover.h" >$@
@@ -651,7 +657,7 @@ dbg: sip-router
dist: tar
-tar:
+tar: autover.h
$(TAR) -C .. \
--exclude=$(notdir $(CURDIR))/test* \
--exclude=$(notdir $(CURDIR))/tmp* \