diff options
Diffstat (limited to 'version.mk')
-rw-r--r-- | version.mk | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/version.mk b/version.mk new file mode 100644 index 0000000..73ecc83 --- /dev/null +++ b/version.mk @@ -0,0 +1,58 @@ +ABI_VERSION := 0 + +# These lines are automatically replaced in tarballs generated by 'make dist' +# Note so you stop forgetting: export-subst attribute can't do tag-relative +VERSION_FULL := $(shell git --git-dir=${SRC_DIR}/.git describe --tags HEAD) +VERSION_HASH := $(shell git --git-dir=${SRC_DIR}/.git rev-parse HEAD) + +version_bits := $(subst v, ,$(subst -, ,$(subst ., ,${VERSION_FULL}))) +# Note: these four numbers are limited to 255. +# Currently, my tags are yy.mm.dd instead of semantic versioning. +# The dev number is how many commits since the last tag. +VERSION_MAJOR := $(word 1,${version_bits}) +VERSION_MINOR := $(word 2,${version_bits}) +VERSION_PATCH := $(word 3,${version_bits}) +VERSION_DEVEL := $(word 4,${version_bits}) +ifeq "${VERSION_DEVEL}" "" + VERSION_DEVEL := 0 +endif + + + +# Settings for those distributing modified versions. +# +# It is strongly recommended that all distributors set these, +# but the only *requirement* is that modified versions that are run +# (semi)publicly give VENDOR_SOURCE to satisfy section 13 of the AGPLv3. + +# TODO should these be passed to configure instead? + +# Vendor Name: String (no newlines, no parentheses) +# This is usually one word, and does not (usually) change over time. +# (Examples: Gentoo, Debian, Fedora, Ubuntu) +VENDOR_NAME := Vanilla +# Vendor Point: Integer (max value 65535) +# This is intended to be the "packaging revision number", assuming that's +# an integer. At a minimum, please try to make it nonzero if you have +# any non-upstream patches (unconditionally nonzero is also okay). +# (If your revision 0 package has patches ... please be nicer to upstream) +VENDOR_POINT := 0 +# URL where the source may be found (after searching for version number). +# See AGPLv3 section 13 +VENDOR_SOURCE := https://github.com/themanaworld/tmwa + +# Convenience +VERSION_STRING := TMWA ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} dev${VERSION_DEVEL} +${VENDOR_POINT} (${VENDOR_NAME}) +VERSION_DOTS := ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${VERSION_DEVEL}.${VENDOR_POINT} + +# Shared libraries +SO_SHORT := so.${ABI_VERSION} +SO_LONG := ${SO_SHORT}.${VERSION_DOTS} +# and thanks for all the fish + +version: + @echo version '${VERSION_STRING}' + @echo based on commit ${VERSION_FULL} aka ${VERSION_HASH} + @echo source ${VENDOR_SOURCE} + @echo abi version ${ABI_VERSION} + @echo 'lib so -> ${SO_SHORT} -> ${SO_LONG}' |