From 32094c850a92fbdc77b05f9d78cb35f385b44c2e Mon Sep 17 00:00:00 2001 From: Gergő J. Miklós Date: Sat, 10 Oct 2020 23:26:19 +0200 Subject: versionstring --- Makefile | 3 ++- src/main.c | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0a3c8c7..d79e2c9 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ CC = gcc ACC = arm-linux-gnueabihf-gcc -CFLAGS = -Wall +DATE = $(shell date "+%Y-%m-%d %H:%M:%S" ) +CFLAGS = -Wall -D"_BUILD_TIME_=\"$(DATE)\"" all: dir x86 ##copy diff --git a/src/main.c b/src/main.c index 357d929..5919421 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,10 @@ #include "hmc5883.h" #define VERSION 1.27 - +#ifndef _BUILD_TIME_ + #define _BUILD_TIME_ __DATE__" "__TIME__ +#endif + // extern void lm75_print_help(void); // extern void lm75_read_all(const char *opts); // extern void lm75_read_one(const char *opts); @@ -29,6 +32,7 @@ // extern void hih61xx_read_one(const char *opts); + uint16 devicef; //# Bus-Device file uchar temp[256]; void (*print_all)(void) = NULL; @@ -57,7 +61,7 @@ void print_help(void) { " i2sensors read_all 1 lm75 0x4f \n" " i2sensors read_one 1 lm75 0x4f 00,-1.35\n" "\n" ); - printf ("Version: v%1.2f, build: [%s %s] (%s), TS: %s STDC: %d\n\n",VERSION,__DATE__,__TIME__,__VERSION__,__TIMESTAMP__,__STDC_VERSION__); + printf ("Version: v%1.2f, build: [%s] (gcc %s) \n\n",VERSION,_BUILD_TIME_,__VERSION__); } void bus_err(int ern){ -- cgit v1.2.3