aboutsummaryrefslogtreecommitdiffhomepage
path: root/AT91SAM7S256/SAM7S256/gcc
diff options
context:
space:
mode:
authorNicolas Schodet2021-09-28 22:24:47 +0200
committerNicolas Schodet2021-09-28 22:56:53 +0200
commit95f27877c886c7ef263e90ad494748733744fce8 (patch)
tree2c2d6844cdd3109ccf7bebb7326fb0e47a538c79 /AT91SAM7S256/SAM7S256/gcc
parent97335845c390f180228cc2806341d34409d78535 (diff)
Change the versioning scheme to use a third number
NXT Improved firmware will now use a x.y.z version numbering scheme. The current version is 1.29.0 and the next one will be 1.29.1. Previously, the commit hash was included in the custom version. This is replaced with a build date corresponding to the newest git commit, unless the SOURCE_DATE_EPOCH environment variable is defined, in which case it will be used as build date. When out of git, if no SOURCE_DATE_EPOCH is defined, it will fall back to the current date. The weird date parsing code in BtTest is gone.
Diffstat (limited to 'AT91SAM7S256/SAM7S256/gcc')
-rw-r--r--AT91SAM7S256/SAM7S256/gcc/Makefile17
1 files changed, 11 insertions, 6 deletions
diff --git a/AT91SAM7S256/SAM7S256/gcc/Makefile b/AT91SAM7S256/SAM7S256/gcc/Makefile
index ed52112..2562b54 100644
--- a/AT91SAM7S256/SAM7S256/gcc/Makefile
+++ b/AT91SAM7S256/SAM7S256/gcc/Makefile
@@ -3,8 +3,13 @@ SRCDIR = $(BASE)/Source
DBGDIR = $(BASE)/armdebug/Debugger
CPUINCDIR = $(BASE)/SAM7S256/Include
-GIT_VERSION := $(shell git rev-parse --short=7 HEAD)
-CUSTOM_FIRMWAREVERSION = $(GIT_VERSION)
+DATE_FMT = +%Y-%m-%dT%H:%M
+ifndef SOURCE_DATE_EPOCH
+ SOURCE_DATE_EPOCH = $(shell git log -1 --pretty=%ct)
+endif
+BUILD_DATE ?= $(shell LC_ALL=C date -u -d "@$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null \
+ || LC_ALL=C date -u -r "$(SOURCE_DATE_EPOCH)" "$(DATE_FMT)" 2>/dev/null \
+ || LC_ALL=C date -u "$(DATE_FMT)")
TARGET = nxt_firmware
@@ -33,7 +38,7 @@ INCLUDES =
MCU = arm7tdmi
STARTOFUSERFLASH_DEFINES = -DSTARTOFUSERFLASH_FROM_LINKER=1
-VERSION_DEFINES = -DCUSTOM_FIRMWAREVERSION=\"$(CUSTOM_FIRMWAREVERSION)\"
+VERSION_DEFINES = -D'BUILD_DATE="$(BUILD_DATE)"'
DEFINES = -DPROTOTYPE_PCB_4 -DNEW_MENU -DROM_RUN -DVECTORS_IN_RAM \
$(STARTOFUSERFLASH_DEFINES) $(VERSION_DEFINES)
OPTIMIZE = -Os -fno-strict-aliasing \
@@ -91,12 +96,12 @@ $(THUMB_OBJECTS): THUMB = -mthumb
-include $(OBJECTS:%.o=%.d)
-LAST_CUSTOM_FIRMWAREVERSION=none
+LAST_BUILD_DATE=none
-include version.mak
-ifneq ($(LAST_CUSTOM_FIRMWAREVERSION),$(CUSTOM_FIRMWAREVERSION))
+ifneq ($(LAST_BUILD_DATE),$(BUILD_DATE))
.PHONY: version.mak
version.mak:
- echo "LAST_CUSTOM_FIRMWAREVERSION = $(CUSTOM_FIRMWAREVERSION)" > $@
+ echo "LAST_BUILD_DATE = $(BUILD_DATE)" > $@
endif
c_ui.o: version.mak