Skip to content

Commit

Permalink
fixup! pkg/tinydtls: Move configurations to 'CONFIG_' namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiman Ismail committed Feb 5, 2020
1 parent 8437126 commit fb1735f
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions pkg/tinydtls/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,22 @@ ifneq (,$(filter tinydtls,$(USEMODULE)))
# NOTE: PSK should be enabled by default BUT if the user define any other cipher
# suite(s) it should not be enabled.
# TODO: Create the flag DTLS_CIPHERS with keywords PSK, ECC (and future)
PSK_ENABLED := $(and $(filter -DCONFIG_DTLS_PSK,$(CFLAGS)), $(filter -DDTLS_PSK,$(CFLAGS)))
ECC_ENABLED := $(and $(filter -DCONFIG_DTLS_ECC,$(CFLAGS)), $(filter -DDTLS_PSK,$(CFLAGS)))
ifeq (, $(and $(PSK_ENABLED),$(ECC_ENABLED)))
PSK_ENABLED := $(or $(filter -DCONFIG_DTLS_PSK,$(CFLAGS)), $(filter -DDTLS_PSK,$(CFLAGS)))
ECC_ENABLED := $(or $(filter -DCONFIG_DTLS_ECC,$(CFLAGS)), $(filter -DDTLS_PSK,$(CFLAGS)))
ifeq (, $(or $(PSK_ENABLED),$(ECC_ENABLED)))
CFLAGS += -DCONFIG_DTLS_PSK
endif
endif

# Enable debug when using tinydtls_sock_dtls
ifneq (,$(or $(CONFIG_DTLS_DEBUG),$(filter -DCONFIG_DTLS_DEBUG,$(CFLAGS))))
ifeq (,$(TINYDTLS_LOG))
CFLAGS += -DTINYDTLS_DEBUG
endif
ifneq (,$(filter -DDTLS_DEBUG,$(CFLAGS)))
# For backwards compability. This can be removed after release 2020.10
$(warning Warning! DTLS_DEBUG is deprecated use CONFIG_DTLS_DEBUG)
CFLAGS += -DCONFIG_DTLS_DEBUG
endif

# Handles the verbosity of tinyDTLS. Default: Minimum or just error messages.
ifeq (,$(filter -DTINYDTLS_DEBUG,$(CFLAGS)))
ifeq ( , $(TINYDTLS_LOG))
CFLAGS += -DTINYDTLS_LOG_LVL=0
else
CFLAGS += -DTINYDTLS_LOG_LVL=$(TINYDTLS_LOG)
endif
else
ifneq (,$(or $(CONFIG_DTLS_DEBUG),$(filter -DCONFIG_DTLS_DEBUG,$(CFLAGS))))
CFLAGS += -DTINYDTLS_LOG_LVL=6
else
CFLAGS += -DTINYDTLS_LOG_LVL=0
endif
endif

Expand Down Expand Up @@ -81,15 +74,6 @@ ifneq (,$(or $(CONFIG_DTLS_ECC),$(filter -DCONFIG_DTLS_ECC,$(CFLAGS))))
CFLAGS += -DDTLS_ECC
endif

ifneq (,$(filter -DTINYDTLS_DEBUG,$(CFLAGS)))
# For backwards compability. This can be removed after release 2020.10
$(warning Warning! TINYDTLS_DEBUG is deprecated use CONFIG_TINYDTLS_DEBUG)
CFLAGS += -DCONFIG_TINYDTLS_DEBUG
endif
ifneq (,$(or $(CONFIG_TINYDTLS_DEBUG),$(filter -DCONFIG_TINYDTLS_DEBUG,$(CFLAGS))))
CFLAGS += -DTINYDTLS_DEBUG
endif

CONTEXT_MAX := $(or $(CONFIG_DTLS_CONTEXT_MAX),$(patsubst -DCONFIG_DTLS_CONTEXT_MAX=%,%,$(filter -DCONFIG_DTLS_CONTEXT_MAX=%,$(CFLAGS))))
ifneq (,$(CONTEXT_MAX))
CFLAGS += -DDTLS_CONTEXT_MAX=$(CONTEXT_MAX)
Expand Down

0 comments on commit fb1735f

Please sign in to comment.