@@ -54,10 +54,10 @@ EXTRA_DIST = \
54
54
bootstrap-configure \
55
55
repos.conf \
56
56
$(srcdir ) /build/autoconf \
57
- $(srcdir ) /config \
58
- $(srcdir ) /config/efr32 \
59
- $(srcdir ) /config/nrf5 \
60
- $(srcdir ) /scripts \
57
+ $(srcdir ) /config \
58
+ $(srcdir ) /config/efr32 \
59
+ $(srcdir ) /config/nrf5 \
60
+ $(srcdir ) /scripts \
61
61
$(NULL )
62
62
63
63
BUILT_SOURCES = \
@@ -70,6 +70,7 @@ dist_doc_DATA = \
70
70
71
71
DISTCLEANFILES = \
72
72
.local-version \
73
+ .local-version.min \
73
74
$(NULL )
74
75
75
76
# There are no source files to lint or prettify in this subdirectory.
@@ -102,24 +103,28 @@ PRETTY_FILES := $(NULL)
102
103
# during makefile execution.
103
104
104
105
VERSION_FILE := $(if $(wildcard $(builddir ) /.local-version) ,$(builddir ) /.local-version,$(if $(wildcard $(srcdir ) /.dist-version) ,$(srcdir ) /.dist-version,$(srcdir ) /.default-version) )
106
+
105
107
#
106
108
# Override autotool's default notion of the package version variables.
107
109
# This ensures that when we create a source distribution the
108
110
# version is always the current version, not the package bootstrap
109
111
# version.
110
112
#
111
- # The two-level variables ensures that not only can the package version
112
- # be overridden from the command line but also when the version is NOT
113
+ # The include ensures that we update CHIP_VERSION and VERSION once
114
+ # we've built .local-version (the source of truth unless CHIP_VERSION
115
+ # is specified on the make command line).
116
+ #
117
+ # CHIP_VERSION can be overridden from the command line, but when the version is NOT
113
118
# overridden that we bind the version once and only once across potential
114
119
# sub-makes to prevent the version from flapping as VERSION_FILE changes.
115
120
#
116
- export MAYBE_CHIP_VERSION := $(shell cat $(VERSION_FILE ) 2> /dev/null)
117
-
118
- CHIP_VERSION ?= $(MAYBE_CHIP_VERSION )
121
+ # .local-version.min sets CHIP_VERSION
122
+ -include .local-version.min
119
123
120
124
PACKAGE_VERSION = $(CHIP_VERSION )
121
125
VERSION = $(PACKAGE_VERSION )
122
126
127
+
123
128
#
124
129
# check-file-.local-version
125
130
#
@@ -140,6 +145,7 @@ $(if $(filter-out file,$(origin CHIP_VERSION)),\
140
145
> "$(2 ) ")
141
146
endef
142
147
148
+
143
149
#
144
150
# check-file-.dist-version
145
151
#
@@ -172,6 +178,10 @@ $(distdir)/.dist-version: $(builddir)/.local-version force
172
178
$(distdir ) /.dist-version $(builddir ) /.local-version :
173
179
$(call check-file,$(@F ) )
174
180
181
+ $(builddir ) /.local-version.min : $(builddir ) /.local-version
182
+ (printf " export CHIP_VERSION=" ; cat) < " $( VERSION_FILE) " > $@
183
+
184
+
175
185
#
176
186
# When we run 'distcheck' and --with-<any of the third-party packages
177
187
# listed in repos.conf>, default to 'internal', the nlbuild-autotools
0 commit comments