Commit 75cbbda5 authored by Adam Wujek's avatar Adam Wujek 💬

Merge branch 'adam-print_ver'

Print version at startup of HAL and RTUd.
Replace "+" with "--dirty" for version printouts
parents dead9ffe 5f917e15
......@@ -17,7 +17,7 @@ wrs_download $tarname
#Export git version to the children call so that it can be use by Makefile
export WRS_GIT_USER="$(cd ${WRS_BASE_DIR} && git config --get user.name)"
export WRS_GIT_REV="$(cd ${WRS_BASE_DIR} && git describe --always --dirty=+)"
export WRS_GIT_REV="$(cd ${WRS_BASE_DIR} && git describe --always --dirty)"
mkdir -p $WRS_OUTPUT_DIR/build || wrs_die "mkdir build"
mkdir -p $WRS_OUTPUT_DIR/images || wrs_die "mkdir images"
......
......@@ -33,7 +33,7 @@ TEMPLATEARG=--template=$(TEMPLATE)
endif
## Obtain the version
VERSION = $(shell git describe --always --dirty=+ | sed 's;^wr-switch-sw-;;')
VERSION = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
DATE = $(shell date +"%d %b. %Y")
#--highlight-style=pygments (the default), kate, monochrome, espresso, haddock, and tango
......
......@@ -87,6 +87,7 @@ void __wrs_msg(int level, const char *func, int line, const char *fmt, ...)
{
va_list args;
static char *header_string[] = {
[LOG_ALERT] = "",
[LOG_ERR] = "Error: ",
[LOG_WARNING] = "Warning: ",
[LOG_INFO] = "",
......
......@@ -34,7 +34,7 @@ CFLAGS = -O2 -g -Wall \
-I../ppsi/arch-wrs/include
# for wrs_version alone (but others may use this)
GIT_VER = $(shell git describe --always --dirty=+ | sed 's;^wr-switch-sw-;;')
GIT_VER = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
GIT_USR = $(shell git config --get-all user.name)
CFLAGS += -D__GIT_USR__="\"${GIT_USR}\"" -D__GIT_VER__="\"${GIT_VER}\""
......
......@@ -22,6 +22,9 @@ CFLAGS = -O -g -Wall \
-I../mini-rpc \
-I$(LINUX)/arch/arm/mach-at91/include
GIT_VER = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
CFLAGS += -D__GIT_VER__="\"${GIT_VER}\""
LDFLAGS = -L../libwr -L../mini-rpc \
-lm -ldl -lwr -lminipc
......
......@@ -190,6 +190,10 @@ int main(int argc, char *argv[])
wrs_msg_init(argc, argv);
/* Print HAL's version */
wrs_msg(LOG_ALERT, "wrsw_hal. Commit %s, built on " __DATE__ "\n",
__GIT_VER__);
/* Prevent from running HAL twice - it will likely freeze the system */
if (hal_check_running()) {
fprintf(stderr, "Fatal: There is another WR HAL "
......
......@@ -23,6 +23,9 @@ CFLAGS = -O2 -Wall -ggdb \
-I../libwr/include \
-I$(LINUX)/arch/arm/mach-at91/include
GIT_VER = $(shell git describe --always --dirty | sed 's;^wr-switch-sw-;;')
CFLAGS += -D__GIT_VER__="\"${GIT_VER}\""
LDFLAGS := -L../libwr -L../mini-rpc\
-lwr -lpthread -lminipc
......
......@@ -355,6 +355,10 @@ int main(int argc, char **argv)
wrs_msg_init(argc, argv);
/* Print RTUd's version */
wrs_msg(LOG_ALERT, "wrsw_rtud. Commit %s, built on " __DATE__ "\n",
__GIT_VER__);
if (argc > 1) {
// Strip out path from argv[0] if exists, and extract command name
for (name = s = argv[0]; s[0]; s++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment