base-files: add URL option for OEM manufacturer info
[openwrt.git] / include / version.mk
1 #
2 # Copyright (C) 2012-2015 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         CONFIG_VERSION_MANUFACTURER \
17         CONFIG_VERSION_MANUFACTURER_URL \
18         CONFIG_VERSION_PRODUCT \
19         CONFIG_VERSION_HWREV \
20
21 qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
22 #'
23
24 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
25 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION))
26
27 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
28 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),Bleeding Edge)
29
30 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
31 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
32
33 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
34 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.openwrt.org/snapshots/trunk/%S/packages)
35
36 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
37 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),OpenWrt)
38
39 VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
40 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),OpenWrt)
41
42 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
43 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://www.openwrt.org/)
44
45 VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
46 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
47
48 VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
49 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
50
51 define taint2sym
52 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
53 endef
54
55 define taint2name
56 $(lastword $(subst :, ,$(1)))
57 endef
58
59 VERSION_TAINT_SPECS := \
60         -ALL_KMODS:no-all \
61         -IPV6:no-ipv6 \
62         +USE_GLIBC:glibc \
63         +USE_MKLIBS:mklibs \
64         +BUSYBOX_CUSTOM:busybox \
65         +OVERRIDE_PKGS:override \
66
67 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
68         $(if $(findstring +,$(taint)), \
69                 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
70                 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
71         )))
72
73 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
74
75 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
76         -e 's,%V,$(VERSION_NUMBER),g' \
77         -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
78         -e 's,%C,$(VERSION_CODE),g' \
79         -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
80         -e 's,%N,$(VERSION_NICK),g' \
81         -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
82         -e 's,%D,$(VERSION_DIST),g' \
83         -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
84         -e 's,%R,$(REVISION),g' \
85         -e 's,%T,$(BOARD),g' \
86         -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
87         -e 's,%t,$(VERSION_TAINTS),g' \
88         -e 's,%M,$(VERSION_MANUFACTURER),g' \
89         -e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
90         -e 's,%P,$(VERSION_PRODUCT),g' \
91         -e 's,%h,$(VERSION_HWREV),g'
92
93 VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))