include UbinizeImage parameters' description in the file
[oweals/openwrt.git] / include / version.mk
1 #
2 # Copyright (C) 2012 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 # Substituted by SDK, do not remove
9 # REVISION:=x
10
11 PKG_CONFIG_DEPENDS += \
12         CONFIG_VERSION_NUMBER \
13         CONFIG_VERSION_NICK \
14         CONFIG_VERSION_REPO \
15         CONFIG_VERSION_DIST
16
17 VERSION_NUMBER:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
18 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION))
19
20 VERSION_CODE:=$(call qstrip,$(CONFIG_VERSION_NUMBER))
21 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),Bleeding Edge)
22
23 VERSION_NICK:=$(call qstrip,$(CONFIG_VERSION_NICK))
24 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
25
26 VERSION_REPO:=$(call qstrip,$(CONFIG_VERSION_REPO))
27 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots/trunk/%T/packages)
28
29 VERSION_DIST:=$(call qstrip,$(CONFIG_VERSION_DIST))
30 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
31
32
33 define taint2sym
34 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
35 endef
36
37 define taint2name
38 $(lastword $(subst :, ,$(1)))
39 endef
40
41 VERSION_TAINT_SPECS := \
42         -ALL:no-all \
43         -IPV6:no-ipv6 \
44         +USE_EGLIBC:eglibc \
45         +USE_MKLIBS:mklibs \
46         +BUSYBOX_CUSTOM:busybox \
47
48 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
49         $(if $(findstring +,$(taint)), \
50                 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
51                 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
52         )))
53
54 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
55
56 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
57         -e 's,%V,$(VERSION_NUMBER),g' \
58         -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
59         -e 's,%C,$(VERSION_CODE),g' \
60         -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
61         -e 's,%N,$(VERSION_NICK),g' \
62         -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
63         -e 's,%D,$(VERSION_DIST),g' \
64         -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
65         -e 's,%R,$(REVISION),g' \
66         -e 's,%T,$(BOARD),g' \
67         -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
68         -e 's,%t,$(VERSION_TAINTS),g' \