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)/examples/platforms/Makefile.platform.am
31
32bin_PROGRAMS                                                           = \
33    $(NULL)
34
35CPPFLAGS_COMMON                                                       += \
36    -I$(top_srcdir)/include                                              \
37    -I$(top_srcdir)/src                                                  \
38    -I$(top_srcdir)/src/core                                             \
39    -I$(top_srcdir)/examples/platforms                                   \
40    $(NULL)
41
42LDADD_COMMON                                                          += \
43    $(top_builddir)/third_party/tcplp/libtcplp.a                         \
44    $(NULL)
45
46LDFLAGS_COMMON                                                        += \
47    $(NULL)
48
49LIBTOOLFLAGS_COMMON                                                   += \
50    $(NULL)
51
52SOURCES_COMMON                                                        += \
53    main.c                                                               \
54    ncp.c                                                                \
55    $(NULL)
56
57LDADD_MBEDTLS                                                          = \
58    $(NULL)
59
60LDADD_MBEDTLS_RADIO                                                    = \
61    $(NULL)
62
63LDADD_DIAG                                                             = \
64    $(NULL)
65
66if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
67LDADD_MBEDTLS                                                         += \
68    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                  \
69    $(NULL)
70
71LDADD_MBEDTLS_RADIO                                                   += \
72    $(top_builddir)/third_party/mbedtls/libmbedcrypto-radio.a            \
73    $(NULL)
74endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
75
76if OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
77LDADD_COMMON                                                          += \
78    $(OPENTHREAD_NCP_SPINEL_ENCRYPTER_LIBS)                              \
79    $(NULL)
80endif # OPENTHREAD_ENABLE_NCP_SPINEL_ENCRYPTER
81
82if OPENTHREAD_ENABLE_NCP
83if OPENTHREAD_ENABLE_FTD
84bin_PROGRAMS                                                          += \
85    ot-ncp-ftd                                                           \
86    $(NULL)
87endif
88endif
89
90ot_ncp_ftd_CPPFLAGS                                                    = \
91    $(CPPFLAGS_COMMON)                                                   \
92    $(NULL)
93
94ot_ncp_ftd_LDADD                                                       = \
95    $(top_builddir)/src/ncp/libopenthread-ncp-ftd.a                      \
96    $(top_builddir)/src/core/libopenthread-ftd.a                         \
97    $(LDADD_COMMON)                                                      \
98    $(LDADD_MBEDTLS)                                                     \
99    $(LDADD_DIAG)                                                        \
100    $(top_builddir)/src/core/libopenthread-ftd.a                         \
101    $(LDADD_COMMON)                                                      \
102    $(LDADD_MBEDTLS)                                                     \
103    $(LDADD_DIAG)                                                        \
104    $(NULL)
105
106ot_ncp_ftd_LDFLAGS                                                     = \
107    $(LDFLAGS_COMMON)                                                    \
108    $(NULL)
109
110ot_ncp_ftd_LIBTOOLFLAGS                                                = \
111    $(LIBTOOLFLAGS_COMMON)                                               \
112    $(NULL)
113
114ot_ncp_ftd_SOURCES                                                     = \
115    $(SOURCES_COMMON)                                                    \
116    $(NULL)
117
118if OPENTHREAD_ENABLE_NCP
119if OPENTHREAD_ENABLE_MTD
120bin_PROGRAMS                                                          += \
121    ot-ncp-mtd                                                           \
122    $(NULL)
123endif
124endif
125
126ot_ncp_mtd_CPPFLAGS                                                    = \
127    $(CPPFLAGS_COMMON)                                                   \
128    $(NULL)
129
130ot_ncp_mtd_LDADD                                                       = \
131    $(top_builddir)/src/ncp/libopenthread-ncp-mtd.a                      \
132    $(top_builddir)/src/core/libopenthread-mtd.a                         \
133    $(LDADD_COMMON)                                                      \
134    $(LDADD_MBEDTLS)                                                     \
135    $(LDADD_DIAG)                                                        \
136    $(top_builddir)/src/core/libopenthread-mtd.a                         \
137    $(LDADD_COMMON)                                                      \
138    $(LDADD_MBEDTLS)                                                     \
139    $(LDADD_DIAG)                                                        \
140    $(NULL)
141
142ot_ncp_mtd_LDFLAGS                                                     = \
143    $(LDFLAGS_COMMON)                                                    \
144    $(NULL)
145
146ot_ncp_mtd_LIBTOOLFLAGS                                                = \
147    $(LIBTOOLFLAGS_COMMON)                                               \
148    $(NULL)
149
150ot_ncp_mtd_SOURCES                                                     = \
151    $(SOURCES_COMMON)                                                    \
152    $(NULL)
153
154if OPENTHREAD_ENABLE_RADIO_ONLY
155bin_PROGRAMS                                                          += \
156    ot-rcp                                                               \
157    $(NULL)
158endif
159
160ot_rcp_CPPFLAGS                                                        = \
161    $(CPPFLAGS_COMMON)                                                   \
162    $(NULL)
163
164ot_rcp_LDADD                                                           = \
165    $(top_builddir)/src/ncp/libopenthread-rcp.a                          \
166    $(top_builddir)/src/core/libopenthread-radio.a                       \
167    $(LDADD_COMMON)                                                      \
168    $(LDADD_MBEDTLS_RADIO)                                               \
169    $(top_builddir)/src/core/libopenthread-radio.a                       \
170    $(LDADD_COMMON)                                                      \
171    $(LDADD_MBEDTLS_RADIO)                                               \
172    $(NULL)
173
174ot_rcp_LDFLAGS                                                         = \
175    $(LDFLAGS_COMMON)                                                    \
176    $(NULL)
177
178ot_rcp_LIBTOOLFLAGS                                                    = \
179    $(LIBTOOLFLAGS_COMMON)                                               \
180    $(NULL)
181
182ot_rcp_SOURCES                                                         = \
183    $(SOURCES_COMMON)                                                    \
184    $(NULL)
185
186if OPENTHREAD_ENABLE_LINKER_MAP
187ot_ncp_ftd_LDFLAGS                                                    += -Wl,-Map=ot-ncp-ftd.map
188ot_ncp_mtd_LDFLAGS                                                    += -Wl,-Map=ot-ncp-mtd.map
189ot_rcp_LDFLAGS                                                        += -Wl,-Map=ot-rcp.map
190endif
191
192if OPENTHREAD_BUILD_COVERAGE
193CPPFLAGS_COMMON                                                       += \
194    -DOPENTHREAD_ENABLE_COVERAGE                                         \
195    $(NULL)
196
197CLEANFILES                                                             = $(wildcard *.gcda *.gcno)
198endif # OPENTHREAD_BUILD_COVERAGE
199
200include $(abs_top_nlbuild_autotools_dir)/automake/post.am
201