Author: marek Date: 2010-06-24 17:36:27 +0200 (Thu, 24 Jun 2010) New Revision: 1723
Modified: trunk/batman-adv/Makefile trunk/batman-adv/Makefile.kbuild Log: batman-adv: Add support for git revision string
The Makefile tries to find a version number which describes the state of the version somebody compiles. Currently this can only be a subversion revision. This must also be done for git as it is used to prepare the actual releases.
The revision string consists of 4 parts: 1. last annotated tag name 2. number of commits inbetween last tag name and this commit 3. shortened sha1 sum of the commit 4. indicator whether the files where modified
The first part is only shown when there was a tag before the commit or the current commit was tagged. Part two and three is only shown when the current commit is not tagged. The indicator is also only shown when the files were modified.
This should make it quite easy understandable for humans and still makes it possible to find the commit in the repository using standard git tools (for that purpose the "-dirty" string must be ommited).
A full example would be v2010.0.0-25-gdc3f30c-dirty
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
Modified: trunk/batman-adv/Makefile =================================================================== --- trunk/batman-adv/Makefile 2010-06-24 15:36:26 UTC (rev 1722) +++ trunk/batman-adv/Makefile 2010-06-24 15:36:27 UTC (rev 1723) @@ -29,17 +29,25 @@
export KERNELPATH
-REVISION= $(shell if [ -d .svn ]; then \ - if which svn > /dev/null; then \ - svn info | grep "Rev:" | sed -e '1p' -n | awk '{print $$4}'; \ - fi; \ - else \ - if [ -d ~/.svk ]; then \ - if which svk > /dev/null; then \ - echo $$(svk info | grep "Mirrored From" | awk '{print $$5}'); \ - fi; \ - fi; \ - fi) +REVISION= $(shell if [ -d .svn ]; then \ + if which svn > /dev/null; then \ + echo rv$$(svn info | grep "Rev:" | sed -e '1p' -n | awk '{print $$4}'); \ + else \ + echo "[unknown]"; \ + fi; \ + elif [ -d .git ]; then \ + if which git > /dev/null; then \ + echo $$(git describe --always --dirty 2> /dev/null); \ + else \ + echo "[unknown]"; \ + fi; \ + elif [ -d ~/.svk ]; then \ + if which svk > /dev/null; then \ + echo rv$$(svk info | grep "Mirrored From" | awk '{print $$5}'); \ + else \ + echo "[unknown]"; \ + fi; \ + fi)
NUM_CPUS = $(shell nproc 2> /dev/null || echo 1)
Modified: trunk/batman-adv/Makefile.kbuild =================================================================== --- trunk/batman-adv/Makefile.kbuild 2010-06-24 15:36:26 UTC (rev 1722) +++ trunk/batman-adv/Makefile.kbuild 2010-06-24 15:36:27 UTC (rev 1723) @@ -28,7 +28,7 @@ # EXTRA_CFLAGS += -DCONFIG_BATMAN_ADV_DEBUG
ifneq ($(REVISION),) -EXTRA_CFLAGS += -DREVISION_VERSION="r$(REVISION)" +EXTRA_CFLAGS += -DREVISION_VERSION="$(REVISION)" endif
obj-m += batman-adv.o