automatically embedding version numbers (#53)

This commit is contained in:
Dien-Nhung Nguyen
2024-10-21 20:06:13 +07:00
committed by GitHub
parent 321677cf9b
commit 9cda33787c
5 changed files with 44 additions and 10 deletions

View File

@@ -15,6 +15,15 @@ TARGET = badgemagic-ch582
OPT = -Os
#######################################
# Get current version
#######################################
VERSION = $(shell git describe --tags --dirty)
VERSION_ABBR = $(shell git describe --abbrev=0 --tags 2>/dev/null || echo "unknown")
ifeq ($(VERSION_ABBR),unknown)
$(warning Unable to determine version from git tags)
endif
#######################################
# paths
#######################################
@@ -127,6 +136,7 @@ ifeq ($(USBC_VERSION), 1)
CFLAGS += -DUSBC_VERSION=$(USBC_VERSION)
endif
CFLAGS += -DVERSION='"$(VERSION)"' -DVERSION_ABBR='"$(VERSION_ABBR)"'
# Generate dependency information
CFLAGS += -MMD -MP