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
30include $(top_srcdir)/src/lib/common.am
31
32EXTRA_DIST                                        = \
33    example_vendor_hook.cpp                         \
34    $(NULL)
35
36# Pull in the sources that comprise the OpenThread NCP library.
37
38lib_LIBRARIES                                     = $(NULL)
39
40if OPENTHREAD_ENABLE_NCP
41if OPENTHREAD_ENABLE_FTD
42lib_LIBRARIES                                    += libopenthread-ncp-ftd.a
43endif
44
45if OPENTHREAD_ENABLE_MTD
46lib_LIBRARIES                                    += libopenthread-ncp-mtd.a
47endif
48endif
49
50if OPENTHREAD_ENABLE_RADIO_ONLY
51lib_LIBRARIES                                    += libopenthread-rcp.a
52endif
53
54COMMON_CPPFLAGS                                   = \
55    -I$(top_srcdir)/include                         \
56    -I$(top_srcdir)/src                             \
57    -I$(top_srcdir)/src/core                        \
58    -I$(top_srcdir)/third_party                     \
59    -D_GNU_SOURCE                                   \
60    -DSPINEL_PLATFORM_HEADER=\"spinel_platform.h\"  \
61    $(OPENTHREAD_TARGET_DEFINES)                    \
62    $(NULL)
63
64libopenthread_ncp_mtd_a_CPPFLAGS                         = \
65    -DOPENTHREAD_RADIO=0                                   \
66    -DOPENTHREAD_FTD=0                                     \
67    -DOPENTHREAD_MTD=1                                     \
68    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
69    $(COMMON_CPPFLAGS)                                     \
70    $(NULL)
71
72libopenthread_ncp_ftd_a_CPPFLAGS                         = \
73    -DOPENTHREAD_RADIO=0                                   \
74    -DOPENTHREAD_FTD=1                                     \
75    -DOPENTHREAD_MTD=0                                     \
76    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=1 \
77    $(COMMON_CPPFLAGS)                                     \
78    $(NULL)
79
80libopenthread_rcp_a_CPPFLAGS                             = \
81    -DOPENTHREAD_RADIO=1                                   \
82    -DOPENTHREAD_RADIO_CLI=0                               \
83    -DOPENTHREAD_FTD=0                                     \
84    -DOPENTHREAD_MTD=0                                     \
85    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=0 \
86    $(COMMON_CPPFLAGS)                                     \
87    $(NULL)
88
89libopenthread_ncp_mtd_a_LIBADD                                                      = \
90    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a)         \
91    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-ncp.a) \
92    $(NULL)
93
94libopenthread_ncp_ftd_a_LIBADD                                                      = \
95    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a  )       \
96    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-ncp.a) \
97    $(NULL)
98
99libopenthread_rcp_a_LIBADD                                                          = \
100    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a)         \
101    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-rcp.a) \
102    $(NULL)
103
104COMMON_SOURCES                                    = \
105    changed_props_set.cpp                           \
106    changed_props_set.hpp                           \
107    ncp_base.cpp                                    \
108    ncp_base.hpp                                    \
109    ncp_base_ftd.cpp                                \
110    ncp_base_mtd.cpp                                \
111    ncp_base_radio.cpp                              \
112    ncp_base_dispatcher.cpp                         \
113    ncp_config.h                                    \
114    ncp_spi.cpp                                     \
115    ncp_spi.hpp                                     \
116    ncp_hdlc.cpp                                    \
117    ncp_hdlc.hpp                                    \
118    $(NULL)
119
120if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
121
122.INTERMEDIATE: ncp_vendor_hook_temp.cpp
123ncp_vendor_hook_temp.cpp: ${OPENTHREAD_NCP_VENDOR_HOOK_SOURCE}
124	$(AM_V_GEN)cp $< $@
125
126# "nodist_" prefix tells automake not to include in 'make dist'
127nodist_libopenthread_ncp_mtd_a_SOURCES            = \
128    ncp_vendor_hook_temp.cpp                        \
129    $(NULL)
130
131# "nodist_" prefix tells automake not to include in 'make dist'
132nodist_libopenthread_ncp_ftd_a_SOURCES            = \
133    ncp_vendor_hook_temp.cpp                        \
134    $(NULL)
135
136endif # if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
137
138libopenthread_ncp_mtd_a_SOURCES                   = \
139   $(COMMON_SOURCES)                                \
140   $(NULL)
141
142libopenthread_ncp_ftd_a_SOURCES                   = \
143   $(COMMON_SOURCES)                                \
144   $(NULL)
145
146libopenthread_rcp_a_SOURCES                       = \
147   $(COMMON_SOURCES)                                \
148   $(NULL)
149
150include_HEADERS                                   = \
151    $(NULL)
152
153include $(abs_top_nlbuild_autotools_dir)/automake/post.am
154