2 # Copyright 2015-2016 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-
23 include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
25 AM_MAKEFLAGS = --no-print-directory
40 $(srcdir)/third_party \
55 # Package version files:
57 # .default-version - The default package version. This file is ALWAYS checked
58 # in and should always represent the current baseline
59 # version of the package.
61 # .dist-version - The distributed package version. This file is NEVER
62 # checked in within the upstream repository, is auto-
63 # generated, and is only found in the package distribution.
65 # .local-version - The current source code controlled package version. This
66 # file is NEVER checked in within the upstream repository,
67 # is auto-generated, and can always be found in both the
68 # build tree and distribution.
70 # When present, the .local-version file is preferred first, the
71 # .dist-version second, and the .default-version last.
74 VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
77 # Override autotool's default notion of the package version variables.
78 # This ensures that when we create a source distribution that the
79 # version is always the current version, not the version when the
80 # package was bootstrapped.
83 NLUNIT_TEST_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
85 PACKAGE_VERSION = $(NLUNIT_TEST_VERSION)
86 VERSION = $(PACKAGE_VERSION)
89 # check-file-.local-version
91 # Speculatively regenerate .local-version and check to see if it needs
94 # If NLUNIT_TEST_VERSION has been supplied anywhere other than in this file
95 # (which is implicitly the contents of .local-version), then use that;
96 # otherwise, attempt to generate it from the SCM system.
98 # This is called from $(call check-file,.local-version).
100 define check-file-.local-version
101 if [ "$(origin NLUNIT_TEST_VERSION)" != "file" ]; then \
102 echo "$(NLUNIT_TEST_VERSION)" > "$(2)"; \
104 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
105 -b "$(NLUNIT_TEST_VERSION)" "$(top_srcdir)" \
111 # check-file-.dist-version
113 # Speculatively regenerate .dist-version and check to see if it needs
116 # This is called from $(call check-file,.dist-version).
118 define check-file-.dist-version
123 # A convenience target to allow package users to easily rerun the
124 # package configuration according to the current configuration.
127 reconfigure: $(builddir)/config.status
128 $(AM_V_at)$(<) --recheck
131 # Version file regeneration rules.
135 $(builddir)/.local-version: $(srcdir)/.default-version force
137 $(distdir)/.dist-version: $(builddir)/.local-version force
139 $(distdir)/.dist-version $(builddir)/.local-version:
140 $(call check-file,$(@F))
142 dist distcheck: $(BUILT_SOURCES)
144 dist-hook: $(distdir)/.dist-version
147 # Top-level convenience target for making a documentation-only
148 # distribution whose results appear at the top level of the build tree
149 # in the same fashion that the distribution would be for 'make dist'.
153 docdist: $(BUILT_SOURCES)
154 $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
156 include $(abs_top_nlbuild_autotools_dir)/automake/post.am