1# 2# Copyright (c) 2016-2017, 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 29# OpenThread Features (Makefile default configuration). 30 31BACKBONE_ROUTER ?= 0 32BIG_ENDIAN ?= 0 33BORDER_AGENT ?= 0 34BORDER_ROUTER ?= 0 35BORDER_ROUTING ?= 0 36COAP ?= 0 37COAP_BLOCK ?= 0 38COAP_OBSERVE ?= 0 39COAPS ?= 0 40COMMISSIONER ?= 0 41COVERAGE ?= 0 42CHANNEL_MANAGER ?= 0 43CHANNEL_MONITOR ?= 0 44CHILD_SUPERVISION ?= 0 45DATASET_UPDATER ?= 0 46DEBUG ?= 0 47DHCP6_CLIENT ?= 0 48DHCP6_SERVER ?= 0 49DIAGNOSTIC ?= 0 50DISABLE_DOC ?= 0 51DISABLE_TOOLS ?= 0 52DNS_CLIENT ?= 0 53DNSSD_SERVER ?= 0 54DUA ?= 0 55DYNAMIC_LOG_LEVEL ?= 0 56ECDSA ?= 0 57EXTERNAL_HEAP ?= 0 58HISTORY_TRACKER ?= 0 59IP6_FRAGM ?= 0 60JAM_DETECTION ?= 0 61JOINER ?= 0 62LEGACY ?= 0 63ifeq ($(REFERENCE_DEVICE),1) 64LOG_OUTPUT ?= APP 65endif 66LINK_RAW ?= 0 67MAC_FILTER ?= 0 68MESSAGE_USE_HEAP ?= 0 69MLE_LONG_ROUTES ?= 0 70MLR ?= 0 71MTD_NETDIAG ?= 0 72MULTIPLE_INSTANCE ?= 0 73NEIGHBOR_DISCOVERY_AGENT ?= 0 74NETDATA_PUBLISHER ?= 0 75OTNS ?= 0 76PING_SENDER ?= 1 77PLATFORM_UDP ?= 0 78REFERENCE_DEVICE ?= 0 79SERVICE ?= 0 80SETTINGS_RAM ?= 0 81# SLAAC is enabled by default 82SLAAC ?= 1 83SNTP_CLIENT ?= 0 84SRP_CLIENT ?= 0 85SRP_SERVER ?= 0 86THREAD_VERSION ?= 1.2 87TIME_SYNC ?= 0 88TREL ?= 0 89UDP_FORWARD ?= 0 90RCP_RESTORATION_MAX_COUNT ?= 0 91 92 93ifeq ($(BACKBONE_ROUTER),1) 94COMMONCFLAGS += -DOPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1 95endif 96 97ifeq ($(BIG_ENDIAN),1) 98COMMONCFLAGS += -DBYTE_ORDER_BIG_ENDIAN=1 99endif 100 101ifeq ($(BORDER_AGENT),1) 102COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1 103endif 104 105ifeq ($(BORDER_ROUTER),1) 106COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1 107endif 108 109ifeq ($(BORDER_ROUTING),1) 110COMMONCFLAGS += -DOPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE=1 111endif 112 113ifeq ($(COAP),1) 114COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_API_ENABLE=1 115endif 116 117ifeq ($(COAPS),1) 118COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1 119endif 120 121ifeq ($(COAP_BLOCK),1) 122COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE=1 123endif 124 125ifeq ($(COAP_OBSERVE),1) 126COMMONCFLAGS += -DOPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE=1 127endif 128 129ifeq ($(COMMISSIONER),1) 130COMMONCFLAGS += -DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1 131endif 132 133ifeq ($(COVERAGE),1) 134configure_OPTIONS += --enable-coverage 135endif 136 137ifeq ($(CHANNEL_MANAGER),1) 138COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1 139endif 140 141ifeq ($(CHANNEL_MONITOR),1) 142COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1 143endif 144 145ifeq ($(CHILD_SUPERVISION),1) 146COMMONCFLAGS += -DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1 147endif 148 149ifeq ($(CSL_RECEIVER),1) 150COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1 151endif 152 153ifeq ($(CSL_AUTO_SYNC),1) 154COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=1 155else ifeq ($(CSL_AUTO_SYNC),0) 156COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_AUTO_SYNC_ENABLE=0 157endif 158 159ifeq ($(CSL_DEBUG),1) 160COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_CSL_DEBUG_ENABLE=1 161endif 162 163ifeq ($(DATASET_UPDATER),1) 164COMMONCFLAGS += -DOPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE=1 165endif 166 167ifeq ($(DEBUG),1) 168configure_OPTIONS += --enable-debug --disable-optimization 169endif 170 171ifeq ($(DHCP6_CLIENT),1) 172COMMONCFLAGS += -DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1 173endif 174 175ifeq ($(DHCP6_SERVER),1) 176COMMONCFLAGS += -DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1 177endif 178 179ifeq ($(DIAGNOSTIC),1) 180COMMONCFLAGS += -DOPENTHREAD_CONFIG_DIAG_ENABLE=1 181endif 182 183ifeq ($(DISABLE_DOC),1) 184configure_OPTIONS += --disable-docs 185endif 186 187ifeq ($(DISABLE_TOOLS),1) 188configure_OPTIONS += --disable-tools 189endif 190 191ifeq ($(DNS_CLIENT),1) 192COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1 193endif 194 195ifeq ($(DNSSD_SERVER),1) 196COMMONCFLAGS += -DOPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE=1 197endif 198 199ifeq ($(DUA),1) 200COMMONCFLAGS += -DOPENTHREAD_CONFIG_DUA_ENABLE=1 201endif 202 203ifeq ($(DYNAMIC_LOG_LEVEL),1) 204COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1 205endif 206 207ifeq ($(ECDSA),1) 208COMMONCFLAGS += -DOPENTHREAD_CONFIG_ECDSA_ENABLE=1 209endif 210 211ifeq ($(EXTERNAL_HEAP),1) 212COMMONCFLAGS += -DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1 213endif 214 215ifeq ($(HISTORY_TRACKER),1) 216COMMONCFLAGS += -DOPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE=1 217endif 218 219ifeq ($(IP6_FRAGM),1) 220COMMONCFLAGS += -DOPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1 221endif 222 223ifeq ($(JAM_DETECTION),1) 224COMMONCFLAGS += -DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1 225endif 226 227ifeq ($(JOINER),1) 228COMMONCFLAGS += -DOPENTHREAD_CONFIG_JOINER_ENABLE=1 229endif 230 231ifeq ($(LEGACY),1) 232COMMONCFLAGS += -DOPENTHREAD_CONFIG_LEGACY_ENABLE=1 233endif 234 235ifeq ($(LINK_RAW),1) 236COMMONCFLAGS += -DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1 237endif 238 239ifeq ($(LINK_METRICS_INITIATOR),1) 240COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE=1 241endif 242 243ifeq ($(LINK_METRICS_SUBJECT),1) 244COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE=1 245endif 246 247ifneq ($(LOG_OUTPUT),) 248COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_$(LOG_OUTPUT) 249endif 250 251ifeq ($(MAC_FILTER),1) 252COMMONCFLAGS += -DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1 253endif 254 255ifeq ($(MESSAGE_USE_HEAP),1) 256COMMONCFLAGS += -DOPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE=1 257endif 258 259# Enable MLE long routes extension (experimental, breaks Thread conformance) 260ifeq ($(MLE_LONG_ROUTES),1) 261COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLE_LONG_ROUTES_ENABLE=1 262endif 263 264ifeq ($(MLR),1) 265COMMONCFLAGS += -DOPENTHREAD_CONFIG_MLR_ENABLE=1 266endif 267 268ifeq ($(MTD_NETDIAG),1) 269COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1 270endif 271 272ifeq ($(MULTIPLE_INSTANCE),1) 273COMMONCFLAGS += -DOPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE=1 274endif 275 276ifeq ($(NEIGHBOR_DISCOVERY_AGENT),1) 277COMMONCFLAGS += -DOPENTHREAD_CONFIG_NEIGHBOR_DISCOVERY_AGENT_ENABLE=1 278endif 279 280ifeq ($(NETDATA_PUBLISHER),1) 281COMMONCFLAGS += -DOPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE=1 282endif 283 284ifeq ($(PING_SENDER),1) 285COMMONCFLAGS += -DOPENTHREAD_CONFIG_PING_SENDER_ENABLE=1 286endif 287 288ifeq ($(PLATFORM_UDP),1) 289COMMONCFLAGS += -DOPENTHREAD_CONFIG_PLATFORM_UDP_ENABLE=1 290endif 291 292# Enable features only required for reference device during certification. 293ifeq ($(REFERENCE_DEVICE),1) 294COMMONCFLAGS += -DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1 295endif 296 297ifeq ($(SERVICE),1) 298COMMONCFLAGS += -DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1 299endif 300 301ifeq ($(SLAAC),1) 302COMMONCFLAGS += -DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1 303endif 304 305ifeq ($(SNTP_CLIENT),1) 306COMMONCFLAGS += -DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1 307endif 308 309ifeq ($(SRP_CLIENT),1) 310COMMONCFLAGS += -DOPENTHREAD_CONFIG_SRP_CLIENT_ENABLE=1 311endif 312 313ifeq ($(SRP_SERVER),1) 314COMMONCFLAGS += -DOPENTHREAD_CONFIG_SRP_SERVER_ENABLE=1 315endif 316 317ifeq ($(THREAD_VERSION),1.1) 318COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=2 319else ifeq ($(THREAD_VERSION),1.2) 320COMMONCFLAGS += -DOPENTHREAD_CONFIG_THREAD_VERSION=3 321endif 322 323ifeq ($(TIME_SYNC),1) 324COMMONCFLAGS += -DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1 -DOPENTHREAD_CONFIG_MAC_HEADER_IE_SUPPORT=1 325endif 326 327ifeq ($(TREL),1) 328COMMONCFLAGS += -DOPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE=1 329endif 330 331ifeq ($(UDP_FORWARD),1) 332COMMONCFLAGS += -DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1 333endif 334 335ifeq ($(DISABLE_BUILTIN_MBEDTLS),1) 336configure_OPTIONS += --disable-builtin-mbedtls 337endif 338 339ifneq ($(BUILTIN_MBEDTLS_MANAGEMENT),) 340COMMONCFLAGS += -DOPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT=$(BUILTIN_MBEDTLS_MANAGEMENT) 341endif 342 343ifeq ($(DISABLE_EXECUTABLE),1) 344configure_OPTIONS += --enable-executable=no 345endif 346 347ifeq ($(DEBUG_UART),1) 348CFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1 349CXXFLAGS += -DOPENTHREAD_CONFIG_ENABLE_DEBUG_UART=1 350endif 351 352ifeq ($(DEBUG_UART_LOG),1) 353CFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART 354CXXFLAGS += -DOPENTHREAD_CONFIG_LOG_OUTPUT=OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART 355endif 356 357ifeq ($(SETTINGS_RAM),1) 358COMMONCFLAGS += -DOPENTHREAD_SETTINGS_RAM=1 359endif 360 361ifeq ($(OTNS),1) 362COMMONCFLAGS += -DOPENTHREAD_CONFIG_OTNS_ENABLE=1 363endif 364 365ifneq ($(SPINEL_ENCRYPTER_LIBS),) 366configure_OPTIONS += --with-ncp-spinel-encrypter-libs=$(SPINEL_ENCRYPTER_LIBS) 367endif 368 369COMMONCFLAGS += -DOPENTHREAD_SPINEL_CONFIG_RCP_RESTORATION_MAX_COUNT=${RCP_RESTORATION_MAX_COUNT} 370 371ifeq ($(FULL_LOGS),1) 372COMMONCFLAGS += -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_DEBG -DOPENTHREAD_CONFIG_LOG_PREPEND_LEVEL=1 -DOPENTHREAD_CONFIG_LOG_PREPEND_REGION=1 373endif 374