blob: a15b3bf3dd92226f9dcd1931289c7bf0f4140b11 [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 \
Michael Morscher6a520dd2017-04-11 18:02:42 +020035 --enable-application-coap \
Shu Chen473b83b2017-06-03 12:49:07 +080036 --enable-border-router \
Kamil Burzynski005781d2017-10-26 21:27:19 +020037 --enable-cli-app=all \
38 --enable-commissioner \
39 --enable-dhcp6-client \
40 --enable-dhcp6-server \
41 --enable-diag \
42 --enable-dns-client \
43 --enable-joiner \
rongli502c6ca2017-07-12 13:38:49 +080044 --enable-mac-filter \
Kamil Burzynski005781d2017-10-26 21:27:19 +020045 --enable-ncp-app=all \
46 --enable-service \
47 --with-examples=posix \
48 --with-ncp-bus=uart \
Jonathan Huie0339622016-06-11 10:32:05 -070049 $(NULL)
Robert Quattlebaum059763b2016-05-19 13:34:40 -070050
Jonathan Hui4f9945c2016-05-10 20:48:47 -070051SUBDIRS = \
Jonathan Huic8908cf2016-05-16 21:41:38 -070052 include \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070053 third_party \
Yakun Xu1b14a362018-06-26 07:32:32 +080054 src \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070055 examples \
56 tests \
Robert Quattlebaum862edfb2016-07-06 18:53:33 -070057 tools \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070058 doc \
59 $(NULL)
60
61EXTRA_DIST = \
62 .default-version \
63 bootstrap \
Nick Banksf6008402016-10-25 13:38:29 -070064 etc \
Robert Quattlebaumc5063e42016-06-09 17:54:14 -070065 README.md \
66 NOTICE \
67 CONTRIBUTING.md \
68 LICENSE \
Jonathan Hui4f9945c2016-05-10 20:48:47 -070069 $(NULL)
70
71BUILT_SOURCES = \
72 .local-version \
73 $(NULL)
74
75dist_doc_DATA = \
76 $(NULL)
77
78DISTCLEANFILES = \
79 .local-version \
80 $(NULL)
81
Jonathan Huid1b0fed2016-05-19 15:46:29 -070082PRETTY_SUBDIRS = \
83 examples \
84 include \
85 src \
86 tests \
Robert Quattlebaum862edfb2016-07-06 18:53:33 -070087 tools \
Jonathan Huid1b0fed2016-05-19 15:46:29 -070088 $(NULL)
89
Shu Chen46f920c2016-10-25 13:13:23 +080090# Ignore the pseudo flash files on Posix platform during diskcheck
91distcleancheck_listfiles = \
92 $(AM_V_at)find . -type f -name "*flash"
93
Jonathan Hui4f9945c2016-05-10 20:48:47 -070094#
95# Package version files:
96#
97# .default-version - The default package version. This file is ALWAYS checked
98# in and should always represent the current baseline
99# version of the package.
100#
101# .dist-version - The distributed package version. This file is NEVER
102# checked in within the upstream repository, is auto-
103# generated, and is only found in the package distribution.
104#
105# .local-version - The current source code controlled package version. This
106# file is NEVER checked in within the upstream repository,
107# is auto-generated, and can always be found in both the
108# build tree and distribution.
109#
110# When present, the .local-version file is preferred first, the
111# .dist-version second, and the .default-version last.
112#
113
114VERSION_FILE := $(if $(wildcard $(builddir)/.local-version),$(builddir)/.local-version,$(if $(wildcard $(srcdir)/.dist-version),$(srcdir)/.dist-version,$(srcdir)/.default-version))
115
116#
117# Override autotool's default notion of the package version variables.
118# This ensures that when we create a source distribution that the
119# version is always the current version, not the version when the
120# package was bootstrapped.
121#
122
123OPENTHREAD_VERSION ?= $(shell cat $(VERSION_FILE) 2> /dev/null)
124
125PACKAGE_VERSION = $(OPENTHREAD_VERSION)
126VERSION = $(PACKAGE_VERSION)
127
Robert Quattlebaum059763b2016-05-19 13:34:40 -0700128distdir = $(PACKAGE)-$(shell \
129if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
130 echo "$(OPENTHREAD_VERSION)" ; \
131else \
132 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
133 -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)"; \
134fi )
135
Jonathan Hui4f9945c2016-05-10 20:48:47 -0700136#
137# check-file-.local-version
138#
139# Speculatively regenerate .local-version and check to see if it needs
140# to be updated.
141#
142# If OPENTHREAD_VERSION has been supplied anywhere other than in this file
143# (which is implicitly the contents of .local-version), then use that;
144# otherwise, attempt to generate it from the SCM system.
145#
146# This is called from $(call check-file,.local-version).
147#
148define check-file-.local-version
149if [ "$(origin OPENTHREAD_VERSION)" != "file" ]; then \
150 echo "$(OPENTHREAD_VERSION)" > "$(2)"; \
151else \
152 $(abs_top_nlbuild_autotools_dir)/scripts/mkversion \
153 -b "$(OPENTHREAD_VERSION)" "$(top_srcdir)" \
154 > "$(2)"; \
155fi
156endef
157
158#
159# check-file-.dist-version
160#
161# Speculatively regenerate .dist-version and check to see if it needs
162# to be updated.
163#
164# This is called from $(call check-file,.dist-version).
165#
166define check-file-.dist-version
167cat "$(1)" > "$(2)"
168endef
169
170#
171# A convenience target to allow package users to easily rerun the
172# package configuration according to the current configuration.
173#
174.PHONY: reconfigure
175reconfigure: $(builddir)/config.status
176 $(AM_V_at)$(<) --recheck
177
178#
179# Version file regeneration rules.
180#
181.PHONY: force
182
183$(builddir)/.local-version: $(srcdir)/.default-version force
184
185$(distdir)/.dist-version: $(builddir)/.local-version force
186
187$(distdir)/.dist-version $(builddir)/.local-version:
188 $(call check-file,$(@F))
189
190dist distcheck: $(BUILT_SOURCES)
191
192dist-hook: $(distdir)/.dist-version
193
194#
195# Top-level convenience target for making a documentation-only
196# distribution whose results appear at the top level of the build tree
197# in the same fashion that the distribution would be for 'make dist'.
198#
199
200.PHONY: docdist
201docdist: $(BUILT_SOURCES)
202 $(MAKE) -C doc docdistdir=$(abs_builddir) $(@)
203
204include $(abs_top_nlbuild_autotools_dir)/automake/post.am