blob: 441d5c413a83ee6308406e1d0b2af1ad6ea00902 [file] [log] [blame]
Jonathan Hui4f9945c2016-05-10 20:48:47 -07001#
Jonathan Hui44350172016-09-13 15:57:11 -07002# Copyright (c) 2016, The OpenThread Authors.
Marcin K Szczodrak99870fa2016-05-12 22:39:11 -07003# All rights reserved.
Jonathan Hui4f9945c2016-05-10 20:48:47 -07004#
Marcin K Szczodrak99870fa2016-05-12 22:39:11 -07005# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10# notice, this list of conditions and the following disclaimer in the
11# documentation and/or other materials provided with the distribution.
12# 3. Neither the name of the copyright holder nor the
13# names of its contributors may be used to endorse or promote products
14# derived from this software without specific prior written permission.
Jonathan Hui4f9945c2016-05-10 20:48:47 -070015#
Marcin K Szczodrak99870fa2016-05-12 22:39:11 -070016# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26# POSSIBILITY OF SUCH DAMAGE.
Jonathan Hui4f9945c2016-05-10 20:48:47 -070027#
28
29include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
30
31AM_MAKEFLAGS = --no-print-directory
32
Jonathan Huie0339622016-06-11 10:32:05 -070033AM_DISTCHECK_CONFIGURE_FLAGS = \
Jonathan Hui3e6546c2017-01-06 13:54:32 -080034 --enable-address-sanitizer \
Jonathan Huia6384422018-09-05 00:35:52 -070035 --enable-cli \
Jonathan Huia6384422018-09-05 00:35:52 -070036 --enable-ftd \
Jonathan Huia6384422018-09-05 00:35:52 -070037 --enable-mtd \
38 --enable-ncp \
Jonathan Huia6384422018-09-05 00:35:52 -070039 --enable-radio-only \
Yakun Xua5511332020-02-28 04:55:56 +080040 --with-examples=simulation \
Jonathan Huie0339622016-06-11 10:32:05 -070041 $(NULL)
Robert Quattlebaum059763b2016-05-19 13:34:40 -070042
Jonathan Hui4f9945c2016-05-10 20:48:47 -070043SUBDIRS = \
Jonathan Huic8908cf2016-05-16 21:41:38 -070044 include \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070045 third_party \
Yakun Xu1b14a362018-06-26 07:32:32 +080046 src \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070047 examples \
48 tests \
Robert Quattlebaum862edfb2016-07-06 18:53:33 -070049 tools \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070050 doc \
51 $(NULL)
52
53EXTRA_DIST = \
54 .default-version \
55 bootstrap \
Nick Banksf6008402016-10-25 13:38:29 -070056 etc \
Robert Quattlebaumc5063e42016-06-09 17:54:14 -070057 README.md \
58 NOTICE \
59 CONTRIBUTING.md \
60 LICENSE \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070061 $(NULL)
62
63BUILT_SOURCES = \
64 .local-version \
65 $(NULL)
66
67dist_doc_DATA = \
68 $(NULL)
69
70DISTCLEANFILES = \
71 .local-version \
72 $(NULL)
73
Shu Chen46f920c2016-10-25 13:13:23 +080074# Ignore the pseudo flash files on Posix platform during diskcheck
75distcleancheck_listfiles = \
76 $(AM_V_at)find . -type f -name "*flash"
77
Jonathan Hui4f9945c2016-05-10 20:48:47 -070078#
79# Package version files:
80#
81# .default-version - The default package version. This file is ALWAYS checked
82# in and should always represent the current baseline
83# version of the package.
84#
85# .dist-version - The distributed package version. This file is NEVER
86# checked in within the upstream repository, is auto-
87# generated, and is only found in the package distribution.
88#
89# .local-version - The current source code controlled package version. This
90# file is NEVER checked in within the upstream repository,
91# is auto-generated, and can always be found in both the
92# build tree and distribution.
93#
94# When present, the .local-version file is preferred first, the
95# .dist-version second, and the .default-version last.
96#
97
98VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
99
100#
101# Override autotool's default notion of the package version variables.
102# This ensures that when we create a source distribution that the
103# version is always the current version, not the version when the
104# package was bootstrapped.
105#
106
107OPENTHREAD_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
108
109PACKAGE_VERSION = $(OPENTHREAD_VERSION)
110VERSION = $(PACKAGE_VERSION)
111
Robert Quattlebaum059763b2016-05-19 13:34:40 -0700112distdir = $(PACKAGE)-$(shell \
113if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
114 echo "$(OPENTHREAD_VERSION)" ; \
115else \
116 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
117 -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)"; \
118fi )
119
Jonathan Hui4f9945c2016-05-10 20:48:47 -0700120#
121# check-file-.local-version
122#
123# Speculatively regenerate .local-version and check to see if it needs
124# to be updated.
125#
126# If OPENTHREAD_VERSION has been supplied anywhere other than in this file
127# (which is implicitly the contents of .local-version), then use that;
128# otherwise, attempt to generate it from the SCM system.
129#
130# This is called from $(call check-file,.local-version).
131#
132define check-file-.local-version
133if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
134 echo "$(OPENTHREAD_VERSION)" > "$(2)"; \
135else \
136 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
137 -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)" \
138 > "$(2)"; \
139fi
140endef
141
142#
143# check-file-.dist-version
144#
145# Speculatively regenerate .dist-version and check to see if it needs
146# to be updated.
147#
148# This is called from $(call check-file,.dist-version).
149#
150define check-file-.dist-version
151cat "$(1)" > "$(2)"
152endef
153
154#
155# A convenience target to allow package users to easily rerun the
156# package configuration according to the current configuration.
157#
158.PHONY: reconfigure
159reconfigure: $(builddir)/config.status
160 $(AM_V_at)$(<) --recheck
161
162#
163# Version file regeneration rules.
164#
165.PHONY: force
166
167$(builddir)/.local-version: $(srcdir)/.default-version force
168
169$(distdir)/.dist-version: $(builddir)/.local-version force
170
171$(distdir)/.dist-version $(builddir)/.local-version:
172 $(call check-file,$(@F))
173
174dist distcheck: $(BUILT_SOURCES)
175
176dist-hook: $(distdir)/.dist-version
177
178#
179# Top-level convenience target for making a documentation-only
180# distribution whose results appear at the top level of the build tree
181# in the same fashion that the distribution would be for 'make dist'.
182#
183
184.PHONY: docdist
185docdist: $(BUILT_SOURCES)
186 $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
187
188include $(abs_top_nlbuild_autotools_dir)/automake/post.am