aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile43
1 files changed, 27 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index f9dc25cd9b2e..faa320a67bf8 100644
--- a/Makefile
+++ b/Makefile
@@ -910,14 +910,19 @@ endif
910# $(localver) 910# $(localver)
911# localversion* (files without backups, containing '~') 911# localversion* (files without backups, containing '~')
912# $(CONFIG_LOCALVERSION) (from kernel config setting) 912# $(CONFIG_LOCALVERSION) (from kernel config setting)
913# $(localver-auto) (only if CONFIG_LOCALVERSION_AUTO is set) 913# $(LOCALVERSION) (from make command line, if provided)
914# ./scripts/setlocalversion (SCM tag, if one exists) 914# $(localver-extra)
915# $(LOCALVERSION) (from make command line if provided) 915# $(scm-identifier) (unique SCM tag, if one exists)
916# ./scripts/setlocalversion (only with CONFIG_LOCALVERSION_AUTO)
917# .scmversion (only with CONFIG_LOCALVERSION_AUTO)
918# + (only without CONFIG_LOCALVERSION_AUTO
919# and without LOCALVERSION= and
920# repository is at non-tagged commit)
916# 921#
917# Note how the final $(localver-auto) string is included *only* if the 922# For kernels without CONFIG_LOCALVERSION_AUTO compiled from an SCM that has
918# kernel config option CONFIG_LOCALVERSION_AUTO is selected. Also, at the 923# been revised beyond a tagged commit, `+' is appended to the version string
919# moment, only git is supported but other SCMs can edit the script 924# when not overridden by using "make LOCALVERSION=". This indicates that the
920# scripts/setlocalversion and add the appropriate checks as needed. 925# kernel is not a vanilla release version and has been modified.
921 926
922pattern = ".*/localversion[^~]*" 927pattern = ".*/localversion[^~]*"
923string = $(shell cat /dev/null \ 928string = $(shell cat /dev/null \
@@ -926,26 +931,32 @@ string = $(shell cat /dev/null \
926localver = $(subst $(space),, $(string) \ 931localver = $(subst $(space),, $(string) \
927 $(patsubst "%",%,$(CONFIG_LOCALVERSION))) 932 $(patsubst "%",%,$(CONFIG_LOCALVERSION)))
928 933
929# If CONFIG_LOCALVERSION_AUTO is set scripts/setlocalversion is called 934# scripts/setlocalversion is called to create a unique identifier if the source
930# and if the SCM is know a tag from the SCM is appended. 935# is managed by a known SCM and the repository has been revised since the last
931# The appended tag is determined by the SCM used. 936# tagged (release) commit. The format of the identifier is determined by the
937# SCM's implementation.
932# 938#
933# .scmversion is used when generating rpm packages so we do not loose 939# .scmversion is used when generating rpm packages so we do not loose
934# the version information from the SCM when we do the build of the kernel 940# the version information from the SCM when we do the build of the kernel
935# from the copied source 941# from the copied source
936ifdef CONFIG_LOCALVERSION_AUTO
937
938ifeq ($(wildcard .scmversion),) 942ifeq ($(wildcard .scmversion),)
939 _localver-auto = $(shell $(CONFIG_SHELL) \ 943 scm-identifier = $(shell $(CONFIG_SHELL) \
940 $(srctree)/scripts/setlocalversion $(srctree)) 944 $(srctree)/scripts/setlocalversion $(srctree))
941else 945else
942 _localver-auto = $(shell cat .scmversion 2> /dev/null) 946 scm-identifier = $(shell cat .scmversion 2> /dev/null)
943endif 947endif
944 948
945 localver-auto = $(LOCALVERSION)$(_localver-auto) 949ifdef CONFIG_LOCALVERSION_AUTO
950 localver-extra = $(scm-identifier)
951else
952 ifneq ($scm-identifier,)
953 ifeq ($(LOCALVERSION),)
954 localver-extra = +
955 endif
956 endif
946endif 957endif
947 958
948localver-full = $(localver)$(localver-auto) 959localver-full = $(localver)$(LOCALVERSION)$(localver-extra)
949 960
950# Store (new) KERNELRELASE string in include/config/kernel.release 961# Store (new) KERNELRELASE string in include/config/kernel.release
951kernelrelease = $(KERNELVERSION)$(localver-full) 962kernelrelease = $(KERNELVERSION)$(localver-full)