diff options
| author | Simon Rettberg | 2020-02-25 11:34:14 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2020-02-25 11:34:14 +0100 |
| commit | a098f40893d8a66a853a74bb80ad5d0cc01b8cb7 (patch) | |
| tree | bbc3d91b6b2b1b764551226c9f9811f870ec4f37 /src/Makefile | |
| parent | Revert "[build] Construct full version number automatically from git revision" (diff) | |
| download | ipxe-a098f40893d8a66a853a74bb80ad5d0cc01b8cb7.tar.gz ipxe-a098f40893d8a66a853a74bb80ad5d0cc01b8cb7.tar.xz ipxe-a098f40893d8a66a853a74bb80ad5d0cc01b8cb7.zip | |
Revert "Revert "[build] Construct full version number automatically from git revision""
This reverts commit eef99e53b4f768167cbc4573be9d2893aee9ba6b.
Revert.
Diffstat (limited to 'src/Makefile')
| -rw-r--r-- | src/Makefile | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile index c0bc45fa6..a84efd6d6 100644 --- a/src/Makefile +++ b/src/Makefile @@ -207,14 +207,27 @@ install : # # Version number calculations # +ifneq ($(wildcard ../.git),) +VERSIONS := $(shell git describe --tags --always --long --abbrev=1 --match "v*") +VERSION_TUPLE := $(subst ., ,$(subst -, ,$(patsubst v%,%,$(VERSIONS)))) +VERSION_MAJOR := $(word 1,$(VERSION_TUPLE)) +VERSION_MINOR := $(word 2,$(VERSION_TUPLE)) +VERSION_PATCH := $(word 3,$(VERSION_TUPLE)) +ifeq ($(word 4,$(VERSION_TUPLE)),0) +EXTRAVERSION := +else +EXTRAVERSION := + +endif +GITVERSION = $(word 5,$(VERSION_TUPLE)) +else VERSION_MAJOR = 1 VERSION_MINOR = 0 VERSION_PATCH = 0 EXTRAVERSION = + +endif MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR) VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION) -ifneq ($(wildcard ../.git),) -GITVERSION := $(shell git describe --always --abbrev=1 --match "" 2>/dev/null) +ifneq ($(GITVERSION),) VERSION += ($(GITVERSION)) endif version : |
