diff --git a/Makefile b/Makefile index eeab5d0942..58324688a6 100644 --- a/Makefile +++ b/Makefile @@ -104,10 +104,17 @@ GEN_HEADERS = $(MESSAGES_H) $(UBX_PROTOCOL_H) $(MTK_PROTOCOL_H) $(XSENS_PROTOCOL all: ground_segment ext lpctools -print_build_version: +_print_building: @echo "------------------------------------------------------------" @echo "Building Paparazzi version" $(shell ./paparazzi_version) @echo "------------------------------------------------------------" + +print_build_version: + @echo "------------------------------------------------------------" + @echo "Last build Paparazzi version" $(shell cat $(PAPARAZZI_HOME)/var/build_version.txt 2> /dev/null || echo UNKNOWN) + @echo "------------------------------------------------------------" + +_save_build_version: $(Q)test -d $(PAPARAZZI_HOME)/var || mkdir -p $(PAPARAZZI_HOME)/var $(Q)./paparazzi_version > $(PAPARAZZI_HOME)/var/build_version.txt @@ -120,12 +127,12 @@ conf/%.xml :conf/%_example.xml [ -L $@ ] || [ -f $@ ] || cp $< $@ -ground_segment: print_build_version update_google_version conf libpprz subdirs commands static +ground_segment: _print_building update_google_version conf libpprz subdirs commands static 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: @@ -311,7 +318,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 _print_building _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 \ diff --git a/Makefile.ac b/Makefile.ac index d892d049d1..3ee019c66e 100644 --- a/Makefile.ac +++ b/Makefile.ac @@ -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 .. 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