mirror of
https://github.com/libretro/RetroArch
synced 2025-02-01 09:32:58 +00:00
Merge pull request #11071 from hhromic/reimpl-git-version
(Makefiles) Re-implement Git version handling
This commit is contained in:
commit
75a764c668
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@
|
|||||||
*.dol
|
*.dol
|
||||||
*.map
|
*.map
|
||||||
*.swp
|
*.swp
|
||||||
|
*.cache
|
||||||
.tmp
|
.tmp
|
||||||
.tmp.c
|
.tmp.c
|
||||||
.tmp.cxx
|
.tmp.cxx
|
||||||
|
@ -158,15 +158,28 @@ ifeq ($(TARGET), retroarch_3ds)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Git Version
|
# Git Version
|
||||||
|
GIT_VERSION_CACHEDIR = $(if $(OBJDIR),$(OBJDIR),$(CURDIR))
|
||||||
|
GIT_VERSION_CACHEFILE = $(GIT_VERSION_CACHEDIR)/git-version.cache
|
||||||
|
|
||||||
GIT_VERSION := $(shell git rev-parse --short HEAD 2>/dev/null)
|
ifneq (,$(wildcard .git/index)) # Building inside a Git repository?
|
||||||
ifneq ($(GIT_VERSION),)
|
GIT_VERSION := $(shell git rev-parse --short HEAD 2>/dev/null)
|
||||||
_CACHEDIR = $(if $(OBJDIR),$(OBJDIR),$(CURDIR))
|
endif
|
||||||
_LAST_GIT_VERSION := $(shell cat "$(_CACHEDIR)"/last-git-version 2>/dev/null)
|
|
||||||
ifneq ($(GIT_VERSION),$(_LAST_GIT_VERSION))
|
ifneq (,$(wildcard $(GIT_VERSION_CACHEFILE))) # Cached Git version?
|
||||||
|
GIT_VERSION_CACHE = $(shell cat "$(GIT_VERSION_CACHEFILE)" 2>/dev/null)
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(GIT_VERSION),)
|
||||||
|
ifneq ($(GIT_VERSION_CACHE),) # If no Git version, use cached if found
|
||||||
|
GIT_VERSION = $(GIT_VERSION_CACHE)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq ($(GIT_VERSION),) # Enable version_git.o?
|
||||||
|
ifneq ($(GIT_VERSION),$(GIT_VERSION_CACHE)) # Update version_git.o?
|
||||||
$(shell \
|
$(shell \
|
||||||
mkdir -p "$(_CACHEDIR)"; \
|
mkdir -p "$(GIT_VERSION_CACHEDIR)" && \
|
||||||
echo "$(GIT_VERSION)" > "$(_CACHEDIR)"/last-git-version; \
|
echo "$(GIT_VERSION)" > "$(GIT_VERSION_CACHEFILE)" && \
|
||||||
touch version_git.c)
|
touch version_git.c)
|
||||||
endif
|
endif
|
||||||
DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=$(GIT_VERSION)
|
DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=$(GIT_VERSION)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user