[build] improve build version stuff

- always save build version when updating anything that depends on libpprz, so it will also be updated on e.g. make tmtc
- only warn if the version number (major.minor.patch) is different, disregard the label, sha1, dirty postfixes in the string...
This commit is contained in:
Felix Ruess
2014-12-21 18:13:00 +01:00
parent d3f9e39533
commit 3f3db735ac
2 changed files with 16 additions and 8 deletions
+5 -4
View File
@@ -84,7 +84,8 @@ ifneq ($(words $(GIT_SHA1)),1)
GIT_SHA1 := "UNKNOWN"
endif
GIT_DESC := $(shell ./paparazzi_version)
BUILD_DESC := $(shell cat $(PAPARAZZI_HOME)/var/build_version.txt)
BUILD_DESC := $(shell cat $(PAPARAZZI_HOME)/var/build_version.txt 2> /dev/null || echo UNKNOWN)
# extract only version number in format <major>.<minor>.<patch>
PPRZ_VER := $(shell echo $(GIT_DESC) | sed 's/[^0-9.]*\([0-9.]*\).*/\1/')
PPRZ_VER_MAJOR := $(shell echo $(GIT_DESC) | sed 's/v\([0-9]*\).*/\1/')
PPRZ_VER_MINOR := $(shell echo $(GIT_DESC) | sed 's/v[0-9]*.\([0-9]*\).*/\1/')
@@ -99,10 +100,10 @@ export PPRZ_VER_MAJOR
export PPRZ_VER_MINOR
export PPRZ_VER_PATCH
ifneq ($(GIT_DESC),$(BUILD_DESC))
VERSION_MATCH = "\nWarning: version differ from build version ($(BUILD_DESC))"
else
# show warning with print_version if PPRZ_VER (e.g. 5.3.2) is not part of the BUILD_DESC string
VERSION_MATCH = ""
ifeq (,$(findstring $(PPRZ_VER),$(BUILD_DESC)))
VERSION_MATCH = "\nWarning: version differs from build version ($(BUILD_DESC)), you might want to run the toplevel make."
endif
# "make Q=''" to get full echo