From 980d1c76804ac5964d40ab96249f5013dd2c5f14 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Tue, 22 Jun 2021 06:35:18 -0400 Subject: [PATCH] utils: report git branch, git commit and if there's any uncommited changes in the logfile. --- Makefile | 7 ++++++- source/core/nxdt_utils.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index f361805..d32db32 100644 --- a/Makefile +++ b/Makefile @@ -40,6 +40,11 @@ include $(DEVKITPRO)/libnx/switch_rules GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD) GIT_COMMIT := $(shell git rev-parse --short HEAD) +GIT_REV := ${GIT_BRANCH}.${GIT_COMMIT} + +ifneq (, $(strip $(shell git status --porcelain 2>/dev/null))) +GIT_REV := $(GIT_REV)-dirty +endif VERSION_MAJOR := 2 VERSION_MINOR := 0 @@ -74,7 +79,7 @@ ARCH := -march=armv8-a+crc+crypto -mtune=cortex-a57 -mtp=soft -fPIE CFLAGS := -g -Wall -Werror -O2 -ffunction-sections $(ARCH) $(DEFINES) $(INCLUDE) -D__SWITCH__ CFLAGS += -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_MICRO=${VERSION_MICRO} CFLAGS += -DAPP_TITLE=\"${APP_TITLE}\" -DAPP_AUTHOR=\"${APP_AUTHOR}\" -DAPP_VERSION=\"${APP_VERSION}\" -CFLAGS += -DGIT_BRANCH=\"${GIT_BRANCH}\" -DGIT_COMMIT=\"${GIT_COMMIT}\" +CFLAGS += -DGIT_BRANCH=\"${GIT_BRANCH}\" -DGIT_COMMIT=\"${GIT_COMMIT}\" -DGIT_REV=\"${GIT_REV}\" CFLAGS += -DBOREALIS_RESOURCES="\"${BOREALIS_RESOURCES}\"" CFLAGS += `aarch64-none-elf-pkg-config zlib --cflags` CFLAGS += `aarch64-none-elf-pkg-config libxml-2.0 --cflags` diff --git a/source/core/nxdt_utils.c b/source/core/nxdt_utils.c index e88e404..853c7b2 100644 --- a/source/core/nxdt_utils.c +++ b/source/core/nxdt_utils.c @@ -106,7 +106,7 @@ bool utilsInitializeResources(const int program_argc, const char **program_argv) /* Create logfile. */ logWriteStringToLogFile("________________________________________________________________\r\n"); - LOG_MSG(APP_TITLE " v%u.%u.%u starting (" GIT_COMMIT "). Built on " __DATE__ " - " __TIME__ ".", VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO); + LOG_MSG(APP_TITLE " v%u.%u.%u starting (" GIT_REV "). Built on " __DATE__ " - " __TIME__ ".", VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO); if (g_appLaunchPath) LOG_MSG("Launch path: \"%s\".", g_appLaunchPath); /* Log Horizon OS version. */