1#
2#  Copyright (c) 2016, The OpenThread Authors.
3#  All rights reserved.
4#
5#  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.
15#
16#  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.
27#
28
29include $(abs_top_nlbuild_autotools_dir)/automake/pre.am
30
31# Always package (e.g. for 'make dist') these subdirectories.
32
33DIST_SUBDIRS                            = \
34    unit                                  \
35    scripts                               \
36    fuzz                                  \
37    $(NULL)
38
39# Always build (e.g. for 'make all') these subdirectories.
40
41SUBDIRS                                 = \
42    $(NULL)
43
44SUBDIRS                                += \
45    unit                                  \
46    $(NULL)
47
48if OPENTHREAD_POSIX
49if OPENTHREAD_ENABLE_CLI
50SUBDIRS                                += \
51    scripts                               \
52    $(NULL)
53endif
54endif
55
56if OPENTHREAD_ENABLE_FUZZ_TARGETS
57SUBDIRS                                += fuzz
58endif
59
60if OPENTHREAD_BUILD_TESTS
61if OPENTHREAD_BUILD_COVERAGE
62CLEANFILES                             = $(wildcard *.gcda *.gcno)
63
64if OPENTHREAD_BUILD_COVERAGE_REPORTS
65# The bundle should positively be qualified with the absolute build
66# path. Otherwise, VPATH will get auto-prefixed to it if there is
67# already such a directory in the non-colocated source tree.
68
69OPENTHREAD_COVERAGE_BUNDLE             = ${abs_builddir}/${PACKAGE}${NL_COVERAGE_BUNDLE_SUFFIX}
70OPENTHREAD_COVERAGE_INFO               = ${OPENTHREAD_COVERAGE_BUNDLE}/${PACKAGE}${NL_COVERAGE_INFO_SUFFIX}
71
72$(OPENTHREAD_COVERAGE_BUNDLE):
73	$(call create-directory)
74
75$(OPENTHREAD_COVERAGE_INFO): check | $(dir $(OPENTHREAD_COVERAGE_INFO))
76	$(call generate-coverage-report,${top_builddir})
77
78coverage-local: $(OPENTHREAD_COVERAGE_INFO)
79
80clean-local: clean-local-coverage
81
82.PHONY: clean-local-coverage
83clean-local-coverage:
84	-$(AM_V_at)rm -rf $(OPENTHREAD_COVERAGE_BUNDLE)
85endif # OPENTHREAD_BUILD_COVERAGE_REPORTS
86endif # OPENTHREAD_BUILD_COVERAGE
87endif # OPENTHREAD_BUILD_TESTS
88
89include $(abs_top_nlbuild_autotools_dir)/automake/post.am
90