1#
2#  Copyright (c) 2020, 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
31noinst_LIBRARIES                                  =
32
33if OPENTHREAD_ENABLE_FTD
34noinst_LIBRARIES                                 += libopenthread-spinel-ncp.a
35endif
36
37if OPENTHREAD_ENABLE_MTD
38noinst_LIBRARIES                                 += libopenthread-spinel-ncp.a
39endif
40
41if OPENTHREAD_ENABLE_SPINEL_RCP
42noinst_LIBRARIES                                 += libopenthread-spinel-rcp.a
43endif
44
45COMMON_CPPFLAGS                                   = \
46    -I$(top_srcdir)/include                         \
47    -I$(top_srcdir)/src                             \
48    -I$(top_srcdir)/src/core                        \
49    -I$(top_srcdir)/third_party                     \
50    -D_GNU_SOURCE                                   \
51    -DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\"  \
52    $(OPENTHREAD_TARGET_DEFINES)                    \
53    $(NULL)
54
55COMMON_SOURCES                                    = \
56    spinel.c                                        \
57    spinel_buffer.cpp                               \
58    spinel_decoder.cpp                              \
59    spinel_encoder.cpp                              \
60    $(NULL)
61
62ot_spinel_headers                                 = \
63    spinel.h                                        \
64    $(NULL)
65
66ot_spineldir = $(includedir)/spinel
67dist_ot_spinel_HEADERS = $(ot_spinel_headers)
68
69include_HEADERS                                   = \
70    $(NULL)
71
72noinst_HEADERS                                    = \
73    radio_spinel.hpp                                \
74    radio_spinel_impl.hpp                           \
75    spinel_buffer.hpp                               \
76    spinel_decoder.hpp                              \
77    spinel_encoder.hpp                              \
78    spinel_platform.h                               \
79    openthread-spinel-config.h                      \
80    $(NULL)
81
82libopenthread_spinel_ncp_a_CPPFLAGS                      = \
83    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
84    $(COMMON_CPPFLAGS)                                     \
85    $(NULL)
86
87libopenthread_spinel_ncp_a_SOURCES                = \
88    $(COMMON_SOURCES)                               \
89    $(NULL)
90
91libopenthread_spinel_rcp_a_CPPFLAGS                      = \
92    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=0 \
93    $(COMMON_CPPFLAGS)                                     \
94    $(NULL)
95
96libopenthread_spinel_rcp_a_SOURCES                = \
97    $(COMMON_SOURCES)                               \
98    $(NULL)
99
100if OPENTHREAD_BUILD_TESTS
101
102check_PROGRAMS                                    = spinel-test
103spinel_test_SOURCES                               = spinel.c
104spinel_test_CFLAGS                                = \
105    $(COMMON_CPPFLAGS)                              \
106    -DSPINEL_SELF_TEST=1                            \
107    -D_GNU_SOURCE                                   \
108    -I$(top_srcdir)/src/core                        \
109    -I$(top_srcdir)/include                         \
110    $(NULL)
111
112TESTS                                             = spinel-test
113
114install-headers: install-includeHEADERS
115
116if OPENTHREAD_BUILD_COVERAGE
117CLEANFILES                                        = $(wildcard *.gcda *.gcno)
118endif # OPENTHREAD_BUILD_COVERAGE
119endif # OPENTHREAD_BUILD_TESTS
120
121include $(abs_top_nlbuild_autotools_dir)/automake/post.am
122