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