uboot-imx6: switch to u-boot.mk
[openwrt/staging/yousong.git] / include / version.mk
1 #
2 # Copyright (C) 2012-2015 OpenWrt.org
3 # Copyright (C) 2016 LEDE Project
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 # Substituted by SDK, do not remove
10 # REVISION:=x
11 # SOURCE_DATE_EPOCH:=x
12
13 RELEASE:=Reboot
14
15 PKG_CONFIG_DEPENDS += \
16 CONFIG_VERSION_BUG_URL \
17 CONFIG_VERSION_NUMBER \
18 CONFIG_VERSION_CODE \
19 CONFIG_VERSION_NICK \
20 CONFIG_VERSION_REPO \
21 CONFIG_VERSION_DIST \
22 CONFIG_VERSION_MANUFACTURER \
23 CONFIG_VERSION_MANUFACTURER_URL \
24 CONFIG_VERSION_PRODUCT \
25 CONFIG_VERSION_SUPPORT_URL \
26 CONFIG_VERSION_HWREV \
27
28 qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
29 #'
30
31 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
32
33 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
34 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),SNAPSHOT)
35
36 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_CODE))
37 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),$(REVISION))
38
39 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
40 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
41
42 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
43 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots)
44
45 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
46 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
47 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
48
49 VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
50 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),LEDE)
51
52 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
53 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://lede-project.org/)
54
55 VERSION_BUG_URL:=$(call qstrip_escape,$(CONFIG_VERSION_BUG_URL))
56 VERSION_BUG_URL:=$(if $(VERSION_BUG_URL),$(VERSION_BUG_URL),http://bugs.lede-project.org/)
57
58 VERSION_SUPPORT_URL:=$(call qstrip_escape,$(CONFIG_VERSION_SUPPORT_URL))
59 VERSION_SUPPORT_URL:=$(if $(VERSION_SUPPORT_URL),$(VERSION_SUPPORT_URL),http://forum.lede-project.org/)
60
61 VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
62 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
63
64 VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
65 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
66
67 define taint2sym
68 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
69 endef
70
71 define taint2name
72 $(lastword $(subst :, ,$(1)))
73 endef
74
75 VERSION_TAINT_SPECS := \
76 -ALL_KMODS:no-all \
77 -IPV6:no-ipv6 \
78 +USE_GLIBC:glibc \
79 +USE_MKLIBS:mklibs \
80 +BUSYBOX_CUSTOM:busybox \
81 +OVERRIDE_PKGS:override \
82
83 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
84 $(if $(findstring +,$(taint)), \
85 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
86 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
87 )))
88
89 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
90
91 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
92 -e 's,%V,$(VERSION_NUMBER),g' \
93 -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
94 -e 's,%C,$(VERSION_CODE),g' \
95 -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
96 -e 's,%N,$(VERSION_NICK),g' \
97 -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
98 -e 's,%D,$(VERSION_DIST),g' \
99 -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
100 -e 's,%R,$(REVISION),g' \
101 -e 's,%T,$(BOARD),g' \
102 -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
103 -e 's,%A,$(ARCH_PACKAGES),g' \
104 -e 's,%t,$(VERSION_TAINTS),g' \
105 -e 's,%M,$(VERSION_MANUFACTURER),g' \
106 -e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
107 -e 's,%b,$(VERSION_BUG_URL),g' \
108 -e 's,%s,$(VERSION_SUPPORT_URL),g' \
109 -e 's,%P,$(VERSION_PRODUCT),g' \
110 -e 's,%h,$(VERSION_HWREV),g'
111
112 VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))