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 Labs
20 # runtime assertion library.
23 include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
25 AM_MAKEFLAGS = --no-print-directory
43 $(srcdir)/third_party/nlbuild-autotools \
59 # Package version files:
61 # .default-version - The default package version. This file is ALWAYS checked
62 # in and should always represent the current baseline
63 # version of the package.
65 # .dist-version - The distributed package version. This file is NEVER
66 # checked in within the upstream repository, is auto-
67 # generated, and is only found in the package distribution.
69 # .local-version - The current source code controlled package version. This
70 # file is NEVER checked in within the upstream repository,
71 # is auto-generated, and can always be found in both the
72 # build tree and distribution.
74 # When present, the .local-version file is preferred first, the
75 # .dist-version second, and the .default-version last.
78 VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
81 # Override autotool's default notion of the package version variables.
82 # This ensures that when we create a source distribution that the
83 # version is always the current version, not the version when the
84 # package was bootstrapped.
87 NLASSERT_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
89 PACKAGE_VERSION = $(NLASSERT_VERSION)
90 VERSION = $(PACKAGE_VERSION)
93 # check-file-.local-version
95 # Speculatively regenerate .local-version and check to see if it needs
98 # If NLASSERT_VERSION has been supplied anywhere other than in this file
99 # (which is implicitly the contents of .local-version), then use that;
100 # otherwise, attempt to generate it from the SCM system.
102 # This is called from $(call check-file,.local-version).
104 define check-file-.local-version
105 if [ "$(origin NLASSERT_VERSION)" != "file" ]; then \
106 echo "$(NLASSERT_VERSION)" > "$(2)"; \
108 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
109 -b "$(NLASSERT_VERSION)" "$(top_srcdir)" \
115 # check-file-.dist-version
117 # Speculatively regenerate .dist-version and check to see if it needs
120 # This is called from $(call check-file,.dist-version).
122 define check-file-.dist-version
127 # A convenience target to allow package users to easily rerun the
128 # package configuration according to the current configuration.
131 reconfigure: $(builddir)/config.status
132 $(AM_V_at)$(<) --recheck
135 # Version file regeneration rules.
139 $(builddir)/.local-version: $(srcdir)/.default-version force
141 $(distdir)/.dist-version: $(builddir)/.local-version force
143 $(distdir)/.dist-version $(builddir)/.local-version:
144 $(call check-file,$(@F))
147 # When we run 'distcheck' and --with-nlunit_test defaults to 'internal',
148 # the nlbuild-autotools infrastructure will attempt to create git paths
149 # to manage the nlunit-test repo. Two directories need to be writable
150 # to facilitate this.
152 DISTCHECK_CONFIGURE_FLAGS=`chmod u+w .. ../third_party`
154 dist distcheck: $(BUILT_SOURCES)
156 dist-hook: $(distdir)/.dist-version
159 # Ensure any locally synchronized repositories defined by 'repos.conf'
163 $(MAKE) -C $(srcdir) -f Makefile-bootstrap clean-repos
166 # Top-level convenience target for making a documentation-only
167 # distribution whose results appear at the top level of the build tree
168 # in the same fashion that the distribution would be for 'make dist'.
172 docdist: $(BUILT_SOURCES)
173 $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
175 include $(abs_top_nlbuild_autotools_dir)/automake/post.am