ramips: add i2c clock
[oweals/openwrt.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
12 RELEASE:=Reboot
13
14 PKG_CONFIG_DEPENDS += \
15         CONFIG_VERSION_NUMBER \
16         CONFIG_VERSION_NICK \
17         CONFIG_VERSION_REPO \
18         CONFIG_VERSION_DIST \
19         CONFIG_VERSION_MANUFACTURER \
20         CONFIG_VERSION_MANUFACTURER_URL \
21         CONFIG_VERSION_PRODUCT \
22         CONFIG_VERSION_HWREV \
23
24 qstrip_escape=$(subst ','\'',$(call qstrip,$(1)))
25 #'
26
27 sanitize = $(call tolower,$(subst _,-,$(subst $(space),-,$(1))))
28
29 VERSION_NUMBER:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
30 VERSION_NUMBER:=$(if $(VERSION_NUMBER),$(VERSION_NUMBER),$(REVISION))
31
32 VERSION_CODE:=$(call qstrip_escape,$(CONFIG_VERSION_NUMBER))
33 VERSION_CODE:=$(if $(VERSION_CODE),$(VERSION_CODE),HEAD)
34
35 VERSION_NICK:=$(call qstrip_escape,$(CONFIG_VERSION_NICK))
36 VERSION_NICK:=$(if $(VERSION_NICK),$(VERSION_NICK),$(RELEASE))
37
38 VERSION_REPO:=$(call qstrip_escape,$(CONFIG_VERSION_REPO))
39 VERSION_REPO:=$(if $(VERSION_REPO),$(VERSION_REPO),http://downloads.lede-project.org/snapshots)
40
41 VERSION_DIST:=$(call qstrip_escape,$(CONFIG_VERSION_DIST))
42 VERSION_DIST:=$(if $(VERSION_DIST),$(VERSION_DIST),LEDE)
43 VERSION_DIST_SANITIZED:=$(call sanitize,$(VERSION_DIST))
44
45 VERSION_MANUFACTURER:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER))
46 VERSION_MANUFACTURER:=$(if $(VERSION_MANUFACTURER),$(VERSION_MANUFACTURER),LEDE)
47
48 VERSION_MANUFACTURER_URL:=$(call qstrip_escape,$(CONFIG_VERSION_MANUFACTURER_URL))
49 VERSION_MANUFACTURER_URL:=$(if $(VERSION_MANUFACTURER_URL),$(VERSION_MANUFACTURER_URL),http://www.lede-project.org/)
50
51 VERSION_PRODUCT:=$(call qstrip_escape,$(CONFIG_VERSION_PRODUCT))
52 VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic)
53
54 VERSION_HWREV:=$(call qstrip_escape,$(CONFIG_VERSION_HWREV))
55 VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0)
56
57 define taint2sym
58 $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1))))))
59 endef
60
61 define taint2name
62 $(lastword $(subst :, ,$(1)))
63 endef
64
65 VERSION_TAINT_SPECS := \
66         -ALL_KMODS:no-all \
67         -IPV6:no-ipv6 \
68         +USE_GLIBC:glibc \
69         +USE_MKLIBS:mklibs \
70         +BUSYBOX_CUSTOM:busybox \
71         +OVERRIDE_PKGS:override \
72
73 VERSION_TAINTS := $(strip $(foreach taint,$(VERSION_TAINT_SPECS), \
74         $(if $(findstring +,$(taint)), \
75                 $(if $(call taint2sym,$(taint)),$(call taint2name,$(taint))), \
76                 $(if $(call taint2sym,$(taint)),,$(call taint2name,$(taint))) \
77         )))
78
79 PKG_CONFIG_DEPENDS += $(foreach taint,$(VERSION_TAINT_SPECS),$(call taint2sym,$(taint)))
80
81 VERSION_SED:=$(SED) 's,%U,$(VERSION_REPO),g' \
82         -e 's,%V,$(VERSION_NUMBER),g' \
83         -e 's,%v,\L$(subst $(space),_,$(VERSION_NUMBER)),g' \
84         -e 's,%C,$(VERSION_CODE),g' \
85         -e 's,%c,\L$(subst $(space),_,$(VERSION_CODE)),g' \
86         -e 's,%N,$(VERSION_NICK),g' \
87         -e 's,%n,\L$(subst $(space),_,$(VERSION_NICK)),g' \
88         -e 's,%D,$(VERSION_DIST),g' \
89         -e 's,%d,\L$(subst $(space),_,$(VERSION_DIST)),g' \
90         -e 's,%R,$(REVISION),g' \
91         -e 's,%T,$(BOARD),g' \
92         -e 's,%S,$(BOARD)/$(if $(SUBTARGET),$(SUBTARGET),generic),g' \
93         -e 's,%A,$(ARCH_PACKAGES),g' \
94         -e 's,%t,$(VERSION_TAINTS),g' \
95         -e 's,%M,$(VERSION_MANUFACTURER),g' \
96         -e 's,%m,$(VERSION_MANUFACTURER_URL),g' \
97         -e 's,%P,$(VERSION_PRODUCT),g' \
98         -e 's,%h,$(VERSION_HWREV),g'
99
100 VERSION_SED_SCRIPT:=$(subst '\'','\'\\\\\'\'',$(VERSION_SED))