Skip to content

Commit a6247bd

Browse files
author
Rob Walker
authored
Prevent empty .local version (project-chip#870)
1 parent 3be137f commit a6247bd

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

Makefile.am

+8-13
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,18 @@ PRETTY_FILES := $(NULL)
102102
# during makefile execution.
103103

104104
VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
105-
106105
#
107106
# Override autotool's default notion of the package version variables.
108107
# This ensures that when we create a source distribution the
109108
# version is always the current version, not the package bootstrap
110109
# version.
111110
#
112-
# The two-level variables and the check against MAKELEVEL ensures that
113-
# not only can the package version be overridden from the command line
114-
# but also when the version is NOT overridden that we bind the version
115-
# once and only once across potential sub-makes to prevent the version
116-
# from flapping as VERSION_FILE changes.
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+
# overridden that we bind the version once and only once across potential
114+
# sub-makes to prevent the version from flapping as VERSION_FILE changes.
117115
#
118-
119-
export MAYBE_CHIP_VERSION := $(if $(filter 0,$(MAKELEVEL)),$(shell cat $(VERSION_FILE) 2> /dev/null),$(MAYBE_CHIP_VERSION))
116+
export MAYBE_CHIP_VERSION := $(shell cat $(VERSION_FILE) 2> /dev/null)
120117

121118
CHIP_VERSION ?= $(MAYBE_CHIP_VERSION)
122119

@@ -136,13 +133,11 @@ VERSION = $(PACKAGE_VERSION)
136133
# This is called from $(call check-file,.local-version).
137134
#
138135
define check-file-.local-version
139-
if [ "$(origin CHIP_VERSION)" != "file" ]; then \
140-
echo "$(CHIP_VERSION)" > "$(2)"; \
141-
else \
136+
$(if $(filter-out file,$(origin CHIP_VERSION)),\
137+
echo "$(CHIP_VERSION)" > "$(2)",\
142138
$(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
143139
-b "$(CHIP_VERSION)" "$(top_srcdir)" \
144-
> "$(2)"; \
145-
fi
140+
> "$(2)")
146141
endef
147142

148143
#

0 commit comments

Comments
 (0)