Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ OSAX_PATH = ./src/osax
INFO_PLIST = $(ASSET_PATH)/Info.plist
BINS = $(BUILD_PATH)/yabai

# Embed the current git commit hash (short) if available
GIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo "")
ifneq ($(GIT_HASH),)
CLI_FLAGS += -DGIT_COMMIT_HASH=\"$(GIT_HASH)\"
endif

.PHONY: all asan tsan install man icon archive publish sign clean-build clean

all: clean-build $(BINS)
Expand Down
4 changes: 4 additions & 0 deletions src/yabai.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ static void parse_arguments(int argc, char **argv)

if ((string_equals(argv[1], VERSION_OPT_LONG)) ||
(string_equals(argv[1], VERSION_OPT_SHRT))) {
#ifdef GIT_COMMIT_HASH
fprintf(stdout, "yabai-v%d.%d.%d-%s\n", MAJOR, MINOR, PATCH, GIT_COMMIT_HASH);
#else
fprintf(stdout, "yabai-v%d.%d.%d\n", MAJOR, MINOR, PATCH);
#endif
exit(EXIT_SUCCESS);
}

Expand Down