Browse Source

core: compile options to skip compile date or set a particular value

- default is current behaviour, date and time included in version string
- compile with no date and time:
  make CC_EXTRA_OPTS="-DVERSION_NODATE"
- compile with a specific date and time:
  make CC_EXTRA_OPTS='"-DVERSION_DATE=\"19:30:40 Feb  8 2015\""'
Daniel-Constantin Mierla 10 years ago
parent
commit
e03d1279f4
2 changed files with 13 additions and 1 deletions
  1. 5 1
      main.c
  2. 8 0
      ver.c

+ 5 - 1
main.c

@@ -1905,8 +1905,12 @@ int main(int argc, char** argv)
 					printf("flags: %s\n", ver_flags );
 					print_ct_constants();
 					printf("id: %s\n", ver_id);
-					printf("compiled on %s with %s\n",
+					if(strlen(ver_compiled_time)>0)
+						printf("compiled on %s with %s\n",
 							ver_compiled_time, ver_compiler );
+					else
+						printf("compiled with %s\n",
+							ver_compiler );
 
 					exit(0);
 					break;

+ 8 - 0
ver.c

@@ -29,7 +29,15 @@ const char ver_version[] = VERSION;
 const char ver_arch[] = ARCH;
 const char ver_os[] = OS_QUOTED;
 const char ver_id[] = REPO_HASH " " REPO_STATE;
+#ifdef VERSION_NODATE
+const char ver_compiled_time[] =  "" ;
+#else
+#ifdef VERSION_DATE
+const char ver_compiled_time[] =  VERSION_DATE ;
+#else
 const char ver_compiled_time[] =  __TIME__ " " __DATE__ ;
+#endif
+#endif
 const char ver_compiler[] = COMPILER;
 
 const char ver_flags[] = SER_COMPILE_FLAGS;