1ifdef CONFIG_OPENTHREAD_ENABLED
2
3COMPONENT_ADD_INCLUDEDIRS :=       \
4    openthread/include             \
5    include
6
7COMPONENT_PRIV_INCLUDEDIRS :=      \
8    openthread/examples/platforms  \
9    openthread/src                 \
10    openthread/src/core            \
11    openthread/src/lib/hdlc        \
12    openthread/src/lib/spinel      \
13    openthread/src/ncp             \
14    private_include
15
16COMPONENT_SRCDIRS :=                      \
17    openthread/examples/apps/cli          \
18    openthread/src/cli                    \
19    openthread/src/core                   \
20    openthread/src/core/api               \
21    openthread/src/core/backbone_router   \
22    openthread/src/core/coap              \
23    openthread/src/core/common            \
24    openthread/src/core/crypto            \
25    openthread/src/core/diags             \
26    openthread/src/core/mac               \
27    openthread/src/core/meshcop           \
28    openthread/src/core/net               \
29    openthread/src/core/radio             \
30    openthread/src/core/thread            \
31    openthread/src/core/utils             \
32    openthread/src/lib/hdlc               \
33    openthread/src/lib/platform           \
34    openthread/src/lib/spinel             \
35    port
36
37ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
38COMPONENT_SRCDIRS += openthread/src/core/border_router
39endif
40
41COMPONENT_OBJEXCLUDE :=                              \
42    openthread/examples/apps/cli/main.o              \
43    openthread/src/core/common/extension_example.o   \
44
45
46COMPONENT_SUBMODULES += lib
47
48ALL_LIB_FILES := $(COMPONENT_PATH)/lib/$(IDF_TARGET)/libopenthread_port.a
49
50ifdef CONFIG_OPENTHREAD_BORDER_ROUTER
51    ALL_LIB_FILES += $(COMPONENT_PATH)/lib/$(IDF_TARGET)/libopenthread_br.a
52endif
53COMPONENT_ADD_LDFLAGS += $(ALL_LIB_FILES)
54
55IDF_VERSION_FOR_OPENTHREAD_PACKAGE := $(shell git -C $(COMPONENT_PATH) rev-parse --short HEAD)
56OPENTHREAD_VERSION := $(shell git -C $(COMPONENT_PATH)/openthread rev-parse --short HEAD)
57OPENTHREAD_PACKAGE_VERSION := $(IDF_VERSION_FOR_OPENTHREAD_PACKAGE)-$(OPENTHREAD_VERSION)
58
59COMMON_FLAGS :=                                                              \
60    -DOPENTHREAD_CONFIG_FILE=\<openthread-core-esp32x-ftd-config.h\>             \
61    -DPACKAGE_VERSION=\"OPENTHREAD_PACKAGE_VERSION\"                         \
62    -Wno-maybe-uninitialized
63
64ifdef CONFIG_OPENTHREAD_FTD
65    COMMON_FLAGS += -DOPENTHREAD_FTD=1
66else ifdef CONFIG_OPENTHREAD_MTD
67    COMMON_FLAGS += -DOPENTHREAD_MTD=1
68else ifdef CONFIG_OPENTHREAD_RADIO
69    COMMON_FLAGS += -DOPENTHREAD_RADIO=1
70endif
71
72CFLAGS += $(COMMON_FLAGS)
73
74CXXFLAGS += $(COMMON_FLAGS)
75
76CPPFLAGS += $(COMMON_FLAGS)
77
78endif
79