diff options
author | Daniel Agar <daniel@agar.ca> | 2015-04-18 00:57:26 -0400 |
---|---|---|
committer | Daniel Agar <daniel@agar.ca> | 2015-04-18 01:25:54 -0400 |
commit | 207b57869d7ed44950a51bbd9632a8549d7a9c49 (patch) | |
tree | 058febbd95ea40c7eb0ba2b926d9378cd7022d0d | |
parent | b53a33bc513a33c784b37a700058bfbc1e15c985 (diff) | |
download | px4-firmware-207b57869d7ed44950a51bbd9632a8549d7a9c49.tar.gz px4-firmware-207b57869d7ed44950a51bbd9632a8549d7a9c49.tar.bz2 px4-firmware-207b57869d7ed44950a51bbd9632a8549d7a9c49.zip |
only define GIT_VERSION where it's used
-when the git revision is passed to every file as a define it causes
unnecessary ccache cache misses
-rw-r--r-- | makefiles/firmware.mk | 5 | ||||
-rw-r--r-- | src/lib/version/version.h | 8 | ||||
-rw-r--r-- | src/modules/sdlog2/module.mk | 1 | ||||
-rw-r--r-- | src/modules/sdlog2/sdlog2.c | 2 | ||||
-rw-r--r-- | src/modules/uavcan/module.mk | 3 | ||||
-rw-r--r-- | src/modules/uavcan/uavcan_main.cpp | 4 | ||||
-rw-r--r-- | src/systemcmds/ver/module.mk | 2 | ||||
-rw-r--r-- | src/systemcmds/ver/ver.c | 2 |
8 files changed, 9 insertions, 18 deletions
diff --git a/makefiles/firmware.mk b/makefiles/firmware.mk index 21e8739aa..4c10de931 100644 --- a/makefiles/firmware.mk +++ b/makefiles/firmware.mk @@ -181,11 +181,6 @@ EXTRA_CLEANS = # -# Extra defines for compilation -# -export EXTRADEFINES := -DGIT_VERSION=$(GIT_DESC) - -# # Append the per-board driver directory to the header search path. # INCLUDE_DIRS += $(PX4_MODULE_SRC)drivers/boards/$(BOARD) diff --git a/src/lib/version/version.h b/src/lib/version/version.h index 873240630..b79fee182 100644 --- a/src/lib/version/version.h +++ b/src/lib/version/version.h @@ -43,14 +43,6 @@ #ifndef VERSION_H_ #define VERSION_H_ -/* - GIT_VERSION is defined at build time via a Makefile call to the - git command line. - */ -#define FREEZE_STR(s) #s -#define STRINGIFY(s) FREEZE_STR(s) -#define FW_GIT STRINGIFY(GIT_VERSION) - #ifdef CONFIG_ARCH_BOARD_PX4FMU_V1 #define HW_ARCH "PX4FMU_V1" #endif diff --git a/src/modules/sdlog2/module.mk b/src/modules/sdlog2/module.mk index 8fded0bdb..6964acf33 100644 --- a/src/modules/sdlog2/module.mk +++ b/src/modules/sdlog2/module.mk @@ -48,3 +48,4 @@ MAXOPTIMIZATION = -Os EXTRACFLAGS = -Wframe-larger-than=1400 +EXTRADEFINES = -DGIT_VERSION='"$(GIT_DESC)"' diff --git a/src/modules/sdlog2/sdlog2.c b/src/modules/sdlog2/sdlog2.c index 2ec733627..ed93a06b1 100644 --- a/src/modules/sdlog2/sdlog2.c +++ b/src/modules/sdlog2/sdlog2.c @@ -764,7 +764,7 @@ int write_version(int fd) }; /* fill version message and write it */ - strncpy(log_msg_VER.body.fw_git, FW_GIT, sizeof(log_msg_VER.body.fw_git)); + strncpy(log_msg_VER.body.fw_git, GIT_VERSION, sizeof(log_msg_VER.body.fw_git)); strncpy(log_msg_VER.body.arch, HW_ARCH, sizeof(log_msg_VER.body.arch)); return write(fd, &log_msg_VER, sizeof(log_msg_VER)); } diff --git a/src/modules/uavcan/module.mk b/src/modules/uavcan/module.mk index f7feeadab..437feb301 100644 --- a/src/modules/uavcan/module.mk +++ b/src/modules/uavcan/module.mk @@ -63,7 +63,8 @@ SRCS += $(subst $(PX4_MODULE_SRC),../../,$(LIBUAVCAN_SRC)) INCLUDE_DIRS += $(LIBUAVCAN_INC) # Since actual compiler mode is C++11, the library will default to UAVCAN_CPP11, but it will fail to compile # because this platform lacks most of the standard library and STL. Hence we need to force C++03 mode. -override EXTRADEFINES := $(EXTRADEFINES) -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_NO_ASSERTIONS +override EXTRADEFINES := $(EXTRADEFINES) -DGIT_VERSION='"$(GIT_DESC)"' -DUAVCAN_CPP_VERSION=UAVCAN_CPP03 -DUAVCAN_NO_ASSERTIONS + # # libuavcan drivers for STM32 diff --git a/src/modules/uavcan/uavcan_main.cpp b/src/modules/uavcan/uavcan_main.cpp index 02cde9656..2d5abf959 100644 --- a/src/modules/uavcan/uavcan_main.cpp +++ b/src/modules/uavcan/uavcan_main.cpp @@ -210,9 +210,9 @@ void UavcanNode::fill_node_info() /* software version */ uavcan::protocol::SoftwareVersion swver; - // Extracting the first 8 hex digits of FW_GIT and converting them to int + // Extracting the first 8 hex digits of GIT_VERSION and converting them to int char fw_git_short[9] = {}; - std::memmove(fw_git_short, FW_GIT, 8); + std::memmove(fw_git_short, GIT_VERSION, 8); assert(fw_git_short[8] == '\0'); char *end = nullptr; swver.vcs_commit = std::strtol(fw_git_short, &end, 16); diff --git a/src/systemcmds/ver/module.mk b/src/systemcmds/ver/module.mk index 2eeb80b61..4597b5f11 100644 --- a/src/systemcmds/ver/module.mk +++ b/src/systemcmds/ver/module.mk @@ -42,3 +42,5 @@ SRCS = ver.c MODULE_STACKSIZE = 1024 MAXOPTIMIZATION = -Os + +EXTRADEFINES = -DGIT_VERSION='"$(GIT_DESC)"' diff --git a/src/systemcmds/ver/ver.c b/src/systemcmds/ver/ver.c index 087eb52e3..b794e8b2f 100644 --- a/src/systemcmds/ver/ver.c +++ b/src/systemcmds/ver/ver.c @@ -101,7 +101,7 @@ int ver_main(int argc, char *argv[]) } if (show_all || !strncmp(argv[1], sz_ver_git_str, sizeof(sz_ver_git_str))) { - printf("FW git-hash: %s\n", FW_GIT); + printf("FW git-hash: %s\n", GIT_VERSION); ret = 0; } |