Gather all available version info.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 15 Jan 2012 14:38:39 +0200
changeset 122 003356f9e504
parent 121 38e8a1063673
child 123 49f373dba523
Gather all available version info.
Makefile
--- a/Makefile	Fri Jan 13 23:41:20 2012 +0200
+++ b/Makefile	Sun Jan 15 14:38:39 2012 +0200
@@ -54,12 +54,25 @@
 -include VERSION
 
 VERSION:
-	ver=$$(hg log -r . --template '{latesttag}'); \
-ver=$${ver#t}; \
-major=$${ver%.*}; \
-minor=$${ver#*.}; \
-printf "vmajor=%s\nvminor=%s\n" $$major $$minor >VERSION
-	# is_release=`hg log --template '{latesttagdistance}'`
+	\
+vtagdist=$$(hg log -r . --template '{latesttagdistance}'); \
+vatrelease=$$([ $$vtagdist = 0 ] && echo yes || echo no); \
+vtag=$$(hg log -r . --template '{latesttag}'); \
+vmajor=$${vtag#t}; \
+vmajor=$${vmajor%.*}; \
+vminor=$${vtag#*.}; \
+vrev=$$(hg id -i); \
+visclean=$$(case $$vrev in *+) echo no;; *) echo yes;; esac); \
+vrev=$${vrev%+}; \
+{ \
+echo "vrev=$$vrev"; \
+echo "vtag=$$vtag"; \
+echo "vtagdist=$$vtagdist"; \
+echo "visclean=$$visclean"; \
+echo "vatrelease=$$vatrelease"; \
+echo "vmajor=$$vmajor"; \
+echo "vminor=$$vminor"; \
+} >VERSION
 
 ################################################################
 # Determine platform/environment.
@@ -266,12 +279,21 @@
 
 .PHONY: help
 help:
-	@echo
-	@echo vmajor=$(vmajor)
-	@echo vminor=$(vminor)
-	@echo
-	@echo Supported targets:
-	@sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPT)
+	@\
+echo; \
+echo Current configuration:; \
+echo; \
+sed 's=^=  =' <VERSION
+	@if [ -f Makefile.config ]; then \
+		echo; \
+		echo User configuration:; \
+		echo; \
+		sed 's=^=  =' <Makefile.config; \
+	fi
+	@\
+echo; \
+echo Supported targets:; \
+sed -n -e '/^[[:alnum:]_-]*:/{s=^\(.*\):.*=  \1=;p;}' $(BUILD_SCRIPT)
 
 .PHONY: stat
 stat: