1#
2#  Copyright (c) 2018, 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    platform                                                             \
35    $(NULL)
36
37# Always build (e.g. for 'make all') these subdirectories.
38
39SUBDIRS                                                                = \
40    platform                                                             \
41    $(NULL)
42
43CPPFLAGS_COMMON                                                        = \
44    -I$(top_srcdir)/include                                              \
45    -I$(top_srcdir)/src/                                                 \
46    -I$(top_srcdir)/src/core                                             \
47    -I$(top_srcdir)/src/posix/platform                                   \
48    -I$(top_srcdir)/src/posix/platform/include                           \
49    -D_GNU_SOURCE                                                        \
50    -DOPENTHREAD_FTD=1                                                   \
51    -DOPENTHREAD_MTD=0                                                   \
52    -DOPENTHREAD_RADIO=0                                                 \
53    $(NULL)
54
55LIBTOOLFLAGS_COMMON = --preserve-dup-deps
56
57LDADD_COMMON                                                           = \
58    $(top_builddir)/src/posix/platform/libopenthread-posix.a             \
59    -lutil                                                               \
60    $(top_builddir)/third_party/tcplp/libtcplp.a                         \
61    $(NULL)
62
63if OPENTHREAD_TARGET_LINUX
64LDADD_COMMON                                                          += \
65    -lrt                                                                 \
66    $(NULL)
67endif
68
69if OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
70LDADD_COMMON                                                          += \
71    $(top_builddir)/third_party/mbedtls/libmbedcrypto.a                  \
72    $(NULL)
73endif # OPENTHREAD_ENABLE_BUILTIN_MBEDTLS
74
75bin_PROGRAMS                                                           = \
76    $(NULL)
77
78if OPENTHREAD_ENABLE_EXECUTABLE
79if OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE
80bin_PROGRAMS                                                          += \
81    ot-ctl                                                               \
82    ot-daemon                                                            \
83    $(NULL)
84else # OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE
85if OPENTHREAD_ENABLE_CLI
86bin_PROGRAMS                                                          += \
87    ot-cli                                                               \
88    $(NULL)
89endif
90endif # OPENTHREAD_POSIX_CONFIG_DAEMON_ENABLE
91
92ot_ctl_SOURCES                                                         = \
93    client.cpp                                                           \
94    $(NULL)
95
96ot_ctl_CPPFLAGS                                                        = \
97    $(CPPFLAGS_COMMON)                                                   \
98    $(NULL)
99
100ot_daemon_CPPFLAGS                                                     = \
101    $(CPPFLAGS_COMMON)                                                   \
102    $(NULL)
103
104ot_daemon_SOURCES                                                      = \
105    main.c                                                               \
106    $(NULL)
107
108ot_daemon_LDADD                                                        = \
109    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                      \
110    $(top_builddir)/src/core/libopenthread-ftd.a                         \
111    $(LDADD_COMMON)                                                      \
112    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                      \
113    $(top_builddir)/src/core/libopenthread-ftd.a                         \
114    $(top_builddir)/src/lib/spinel/libopenthread-spinel-rcp.a            \
115    $(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a                    \
116    $(LDADD_COMMON)                                                      \
117    $(NULL)
118
119ot_daemon_LDFLAGS                                                      = \
120    $(LDFLAGS_COMMON)                                                    \
121    $(NULL)
122
123ot_daemon_LIBTOOLFLAGS                                                 = \
124    $(LIBTOOLFLAGS_COMMON)                                               \
125    $(NULL)
126
127ot_cli_CPPFLAGS                                                        = \
128    $(CPPFLAGS_COMMON)                                                   \
129    $(NULL)
130
131ot_cli_SOURCES                                                         = \
132    main.c                                                               \
133    cli_readline.cpp                                                     \
134    cli_stdio.cpp                                                        \
135    $(NULL)
136
137ot_cli_LDADD                                                           = \
138    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                      \
139    $(top_builddir)/src/core/libopenthread-ftd.a                         \
140    $(LDADD_COMMON)                                                      \
141    $(top_builddir)/src/cli/libopenthread-cli-ftd.a                      \
142    $(top_builddir)/src/core/libopenthread-ftd.a                         \
143    $(top_builddir)/src/lib/spinel/libopenthread-spinel-rcp.a            \
144    $(top_builddir)/src/lib/hdlc/libopenthread-hdlc.a                    \
145    $(LDADD_COMMON)                                                      \
146    $(NULL)
147
148ot_cli_LDFLAGS                                                         = \
149    $(LDFLAGS_COMMON)                                                    \
150    $(NULL)
151
152ot_cli_LIBTOOLFLAGS                                                    = \
153    $(LIBTOOLFLAGS_COMMON)                                               \
154    $(NULL)
155
156if OPENTHREAD_ENABLE_LINKER_MAP
157ot_cli_LDFLAGS                                                        += -Wl,-Map=ot-cli-mtd.map
158endif
159
160if OPENTHREAD_BUILD_COVERAGE
161CPPFLAGS_COMMON                                                       += \
162    -DOPENTHREAD_ENABLE_COVERAGE                                         \
163    $(NULL)
164
165CLEANFILES                                                             = $(wildcard *.gcda *.gcno)
166endif # OPENTHREAD_BUILD_COVERAGE
167endif # OPENTHREAD_ENABLE_EXECUTABLE
168
169include $(abs_top_nlbuild_autotools_dir)/automake/post.am
170