summaryrefslogtreecommitdiff
path: root/version.make
blob: 73ecc83c07e0726007825da7a823d98ee52e9582 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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}'