diff --git a/libs/libc/misc/Make.defs b/libs/libc/misc/Make.defs index 31a06aa4a9..1dc984c108 100644 --- a/libs/libc/misc/Make.defs +++ b/libs/libc/misc/Make.defs @@ -109,6 +109,11 @@ ifeq ($(CONFIG_LIB_ENVPATH),y) CSRCS += lib_envpath.c endif +# To ensure uname information is newest, +# add lib_utsname.o to phony target for force rebuild + +.PHONY: lib_utsname$(OBJEXT) + # Add the misc directory to the build DEPPATH += --dep-path misc diff --git a/libs/libc/misc/lib_utsname.c b/libs/libc/misc/lib_utsname.c index fc8470bfc7..0a97a6f807 100644 --- a/libs/libc/misc/lib_utsname.c +++ b/libs/libc/misc/lib_utsname.c @@ -40,6 +40,7 @@ #include #include +#include #include #include @@ -115,7 +116,12 @@ int uname(FAR struct utsname *name) strncpy(name->release, CONFIG_VERSION_STRING, SYS_NAMELEN); name->release[SYS_NAMELEN-1] = '\0'; +#if defined(__DATE__) && defined(__TIME__) + snprintf(name->version, VERSION_NAMELEN, "%s %s %s", + CONFIG_VERSION_BUILD, __DATE__, __TIME__); +#else strncpy(name->version, CONFIG_VERSION_BUILD, VERSION_NAMELEN); +#endif name->version[VERSION_NAMELEN-1] = '\0'; strncpy(name->machine, CONFIG_ARCH, SYS_NAMELEN);