diff --git a/Makefile b/Makefile index 3eaebb7e..45dc3bc3 100755 --- a/Makefile +++ b/Makefile @@ -72,6 +72,8 @@ else endif endif +GIT_HASH = $(shell git rev-parse --short HEAD) +$(info GIT_HASH: $(GIT_HASH) ) # Main source files SRCS = aqualinkd.c utils.c config.c aq_serial.c aq_panel.c aq_programmer.c \ @@ -125,9 +127,9 @@ endif # Put all flags together. -CFLAGS = $(GCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DFLAGS = $(DGCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DBG_CFLAGS = $(DBGFLAGS) $(AQ_FLAGS) $(MGFLAGS) +CFLAGS = $(GCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\"" +DFLAGS = $(DGCCFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\"" +DBG_CFLAGS = $(DBGFLAGS) $(AQ_FLAGS) $(MGFLAGS) -DGIT_HASH="\"$(GIT_HASH)\"" # Other sources. DBG_SRC = $(SRCS) debug_timer.c diff --git a/aqualinkd.c b/aqualinkd.c index dd311728..11889cbb 100644 --- a/aqualinkd.c +++ b/aqualinkd.c @@ -1046,7 +1046,7 @@ void action_delayed_request() void printHelp() { - printf("%s %s\n",AQUALINKD_NAME,AQUALINKD_VERSION); + printf("%s %s (rev %s)\n", AQUALINKD_NAME, AQUALINKD_VERSION, GIT_HASH); printf("\t-h (this message)\n"); printf("\t-d (do not deamonize)\n"); printf("\t-c (Configuration file)\n"); @@ -1231,7 +1231,7 @@ int startup(char *self, char *cfgFile) setLoggingPrms(_aqconfig_.log_level, _aqconfig_.deamonize, _aqconfig_.log_file, NULL); #endif - LOG(AQUA_LOG,LOG_NOTICE, "%s v%s\n", AQUALINKD_NAME, AQUALINKD_VERSION); + LOG(AQUA_LOG,LOG_NOTICE, "%s v%s (rev %s)\n", AQUALINKD_NAME, AQUALINKD_VERSION, GIT_HASH); /* LOG(AQUA_LOG,LOG_NOTICE, "Panel set to %s%s-%d %s%s %s\n", isRS_PANEL?"RS":"", diff --git a/json_messages.c b/json_messages.c index 5d0940a9..3c80f057 100644 --- a/json_messages.c +++ b/json_messages.c @@ -555,7 +555,7 @@ int build_aqualink_status_JSON(struct aqualinkdata *aqdata, char* buffer, int si length += sprintf(buffer+length, ",\"panel_type\":\"%s\"",getPanelString()); //length += sprintf(buffer+length, ",\"message\":\"%s\"",aqdata->message ); length += sprintf(buffer+length, ",\"version\":\"%s\"",aqdata->version );//8157 REV MMM", - length += sprintf(buffer+length, ",\"aqualinkd_version\":\"%s\"", AQUALINKD_VERSION ); //1.0b, + length += sprintf(buffer+length, ",\"aqualinkd_version\":\"%s (rev %s)\"", AQUALINKD_VERSION, GIT_HASH); //1.0b, length += sprintf(buffer+length, ",\"date\":\"%s\"",aqdata->date );//"09/01/16 THU", length += sprintf(buffer+length, ",\"time\":\"%s\"",aqdata->time );//"1:16 PM", //length += sprintf(buffer+length, ",\"air_temp\":\"%d\"",aqdata->air_temp );//"96",