2 # Copyright 2015-2018 Nest Labs Inc. All Rights Reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
19 # This file is the GNU automake template for the Nest memory-
22 include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
24 AM_MAKEFLAGS = --no-print-directory
42 $(srcdir)/third_party/nlbuild-autotools \
58 # Package version files:
60 # .default-version - The default package version. This file is ALWAYS checked
61 # in and should always represent the current baseline
62 # version of the package.
64 # .dist-version - The distributed package version. This file is NEVER
65 # checked in within the upstream repository, is auto-
66 # generated, and is only found in the package distribution.
68 # .local-version - The current source code controlled package version. This
69 # file is NEVER checked in within the upstream repository,
70 # is auto-generated, and can always be found in both the
71 # build tree and distribution.
73 # When present, the .local-version file is preferred first, the
74 # .dist-version second, and the .default-version last.
77 VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
80 # Override autotool's default notion of the package version variables.
81 # This ensures that when we create a source distribution that the
82 # version is always the current version, not the version when the
83 # package was bootstrapped.
86 NLIO_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
88 PACKAGE_VERSION = $(NLIO_VERSION)
89 VERSION = $(PACKAGE_VERSION)
92 # check-file-.local-version
94 # Speculatively regenerate .local-version and check to see if it needs
97 # If NLIO_VERSION has been supplied anywhere other than in this file
98 # (which is implicitly the contents of .local-version), then use that;
99 # otherwise, attempt to generate it from the SCM system.
101 # This is called from $(call check-file,.local-version).
103 define check-file-.local-version
104 if [ "$(origin NLIO_VERSION)" != "file" ]; then \
105 echo "$(NLIO_VERSION)" > "$(2)"; \
107 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
108 -b "$(NLIO_VERSION)" "$(top_srcdir)" \
114 # check-file-.dist-version
116 # Speculatively regenerate .dist-version and check to see if it needs
119 # This is called from $(call check-file,.dist-version).
121 define check-file-.dist-version
126 # A convenience target to allow package users to easily rerun the
127 # package configuration according to the current configuration.
130 reconfigure: $(builddir)/config.status
131 $(AM_V_at)$(<) --recheck
134 # Version file regeneration rules.
138 $(builddir)/.local-version: $(srcdir)/.default-version force
140 $(distdir)/.dist-version: $(builddir)/.local-version force
142 $(distdir)/.dist-version $(builddir)/.local-version:
143 $(call check-file,$(@F))
146 # When we run 'distcheck' and --with-nlunit_test defaults to 'internal',
147 # the nlbuild-autotools infrastructure will attempt to create git paths
148 # to manage the nlunit-test repo. Two directories need to be writable
149 # to facilitate this.
151 DISTCHECK_CONFIGURE_FLAGS=`chmod u+w .. ../third_party`
153 dist distcheck: $(BUILT_SOURCES)
155 dist-hook: $(distdir)/.dist-version
158 # Ensure any locally synchronized repositories defined by 'repos.conf'
162 $(MAKE) -C $(srcdir) -f Makefile-bootstrap clean-repos
165 # Top-level convenience target for making a documentation-only
166 # distribution whose results appear at the top level of the build tree
167 # in the same fashion that the distribution would be for 'make dist'.
171 docdist: $(BUILT_SOURCES)
172 $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
174 include $(abs_top_nlbuild_autotools_dir)/automake/post.am