Skip to content

Commit

Permalink
[build] improve build version stuff
Browse files Browse the repository at this point in the history
- 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...
  • Loading branch information
flixr committed Dec 21, 2014
1 parent 4170ce5 commit b7f5943
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
6 changes: 4 additions & 2 deletions Makefile
Expand Up @@ -108,6 +108,8 @@ print_build_version:
@echo "------------------------------------------------------------"
@echo "Building Paparazzi version" $(shell ./paparazzi_version)
@echo "------------------------------------------------------------"

save_build_version:
$(Q)test -d $(PAPARAZZI_HOME)/var || mkdir -p $(PAPARAZZI_HOME)/var
$(Q)./paparazzi_version > $(PAPARAZZI_HOME)/var/build_version.txt

Expand All @@ -125,7 +127,7 @@ ground_segment.opt: ground_segment cockpit.opt tmtc.opt

static: cockpit tmtc generators sim_static joystick static_h

libpprz:
libpprz: save_build_version
$(MAKE) -C $(LIB)/ocaml

multimon:
Expand Down Expand Up @@ -311,7 +313,7 @@ run_tests:
test: all replace_current_conf_xml run_tests restore_conf_xml


.PHONY: all print_build_version update_google_version dox ground_segment ground_segment.opt \
.PHONY: all print_build_version save_build_version update_google_version dox ground_segment ground_segment.opt \
subdirs $(SUBDIRS) conf ext libpprz multimon cockpit cockpit.opt tmtc tmtc.opt generators\
static sim_static lpctools commands \
clean cleanspaces ab_clean dist_clean distclean dist_clean_irreversible \
Expand Down
9 changes: 5 additions & 4 deletions Makefile.ac
Expand Up @@ -84,7 +84,7 @@ 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)
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/')
Expand All @@ -99,11 +99,12 @@ 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
VERSION_MATCH = ""
#ifneq ($(BUILD_DESC), UNKNOWN)
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
#endif

# "make Q=''" to get full echo
Q=@
Expand Down

0 comments on commit b7f5943

Please sign in to comment.