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_FTD=0                                     \
83    -DOPENTHREAD_MTD=0                                     \
84    -DOPENTHREAD_SPINEL_CONFIG_OPENTHREAD_MESSAGE_ENABLE=0 \
85    $(COMMON_CPPFLAGS)                                     \
86    $(NULL)
87
88libopenthread_ncp_mtd_a_LIBADD                                                      = \
89    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a)         \
90    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-ncp.a) \
91    $(NULL)
92
93libopenthread_ncp_ftd_a_LIBADD                                                      = \
94    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a  )       \
95    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-ncp.a) \
96    $(NULL)
97
98libopenthread_rcp_a_LIBADD                                                          = \
99    $(call ot_list_objects,$(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a)         \
100    $(call ot_list_objects,$(top_builddir)/src/lib/spinel/libopenthread-spinel-rcp.a) \
101    $(NULL)
102
103COMMON_SOURCES                                    = \
104    changed_props_set.cpp                           \
105    changed_props_set.hpp                           \
106    ncp_base.cpp                                    \
107    ncp_base.hpp                                    \
108    ncp_base_ftd.cpp                                \
109    ncp_base_mtd.cpp                                \
110    ncp_base_radio.cpp                              \
111    ncp_base_dispatcher.cpp                         \
112    ncp_config.h                                    \
113    ncp_spi.cpp                                     \
114    ncp_spi.hpp                                     \
115    ncp_hdlc.cpp                                    \
116    ncp_hdlc.hpp                                    \
117    $(NULL)
118
119if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
120
121.INTERMEDIATE: ncp_vendor_hook_temp.cpp
122ncp_vendor_hook_temp.cpp: ${OPENTHREAD_NCP_VENDOR_HOOK_SOURCE}
123	$(AM_V_GEN)cp $< $@
124
125# "nodist_" prefix tells automake not to include in 'make dist'
126nodist_libopenthread_ncp_mtd_a_SOURCES            = \
127    ncp_vendor_hook_temp.cpp                        \
128    $(NULL)
129
130# "nodist_" prefix tells automake not to include in 'make dist'
131nodist_libopenthread_ncp_ftd_a_SOURCES            = \
132    ncp_vendor_hook_temp.cpp                        \
133    $(NULL)
134
135endif # if OPENTHREAD_ENABLE_NCP_VENDOR_HOOK
136
137libopenthread_ncp_mtd_a_SOURCES                   = \
138   $(COMMON_SOURCES)                                \
139   $(NULL)
140
141libopenthread_ncp_ftd_a_SOURCES                   = \
142   $(COMMON_SOURCES)                                \
143   $(NULL)
144
145libopenthread_rcp_a_SOURCES                       = \
146   $(COMMON_SOURCES)                                \
147   $(NULL)
148
149include_HEADERS                                   = \
150    $(NULL)
151
152include $(abs_top_nlbuild_autotools_dir)/automake/post.am
153