From 54d10021e3f8347a5999a9f172f3385029c7f16b Mon Sep 17 00:00:00 2001 From: Jin-Seong Kim Date: Wed, 9 Aug 2017 10:58:33 +0900 Subject: [PATCH] netutils/libcoap : moves CFLAGS on Makefile to libcoap config.h This commit is patch to move CFLAGS on Makefile to libcoap config.h CFLAG definitions used for TinzenRT are located in Makefile - WITH_POSIX, WITH_MBEDTLS, NDEBUG and WITH_TCP accordingly build sequence, build error can be happened without CFLAGS to prevent compilation error due to CFLAGS, those definitions are moved to config.h (configuration file only used by libcoap) Change-Id: Ic5d1d0fb2bb7c892555393daf54c3f9d427cc951 Signed-off-by: Jin-Seong Kim --- apps/examples/libcoap_client/Makefile | 12 --------- apps/examples/libcoap_server/Makefile | 12 --------- apps/examples/libcoap_server/libcoap-server.c | 2 -- apps/include/netutils/libcoap/config.h | 25 +++++++++++++++++++ apps/include/netutils/libcoap/debug.h | 1 + apps/include/netutils/libcoap/encode.h | 2 +- apps/include/netutils/libcoap/lwippools.h | 35 --------------------------- apps/netutils/libcoap/Makefile | 12 --------- 8 files changed, 27 insertions(+), 74 deletions(-) delete mode 100644 apps/include/netutils/libcoap/lwippools.h diff --git a/apps/examples/libcoap_client/Makefile b/apps/examples/libcoap_client/Makefile index 945d845..0499d0b 100644 --- a/apps/examples/libcoap_client/Makefile +++ b/apps/examples/libcoap_client/Makefile @@ -57,18 +57,6 @@ MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) -# libcoap flags -CFLAGS += -DWITH_POSIX -CFLAGS += -D__TINYARA__ -ifeq ($(CONFIG_NETUTILS_LIBCOAP_DEBUG),n) -CFLAGS += -DNDEBUG -endif -ifeq ($(CONFIG_NET_SECURITY_TLS),y) -CFLAGS += -DWITH_MBEDTLS -endif -CFLAGS += -DWITH_TCP -#CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)$(DELIM)include$(DELIM)netutils$(DELIM)libcoap} - ifneq ($(CONFIG_BUILD_KERNEL),y) OBJS += $(MAINOBJ) endif diff --git a/apps/examples/libcoap_server/Makefile b/apps/examples/libcoap_server/Makefile index f50064a..8c9ba68 100644 --- a/apps/examples/libcoap_server/Makefile +++ b/apps/examples/libcoap_server/Makefile @@ -57,18 +57,6 @@ MAINOBJ = $(MAINSRC:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) $(MAINSRC) OBJS = $(AOBJS) $(COBJS) -# libcoap flags -CFLAGS += -DWITH_POSIX -CFLAGS += -D__TINYARA__ -ifeq ($(CONFIG_NETUTILS_LIBCOAP_DEBUG),n) -CFLAGS += -DNDEBUG -endif -ifeq ($(CONFIG_NET_SECURITY_TLS),y) -CFLAGS += -DWITH_MBEDTLS -endif -CFLAGS += -DWITH_TCP -#CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)$(DELIM)include$(DELIM)netutils$(DELIM)libcoap} - ifneq ($(CONFIG_BUILD_KERNEL),y) OBJS += $(MAINOBJ) endif diff --git a/apps/examples/libcoap_server/libcoap-server.c b/apps/examples/libcoap_server/libcoap-server.c index d5f4bfc..f065537 100644 --- a/apps/examples/libcoap_server/libcoap-server.c +++ b/apps/examples/libcoap_server/libcoap-server.c @@ -7,8 +7,6 @@ * README for terms of use. */ -#include - #include #include #include diff --git a/apps/include/netutils/libcoap/config.h b/apps/include/netutils/libcoap/config.h index 7c6a4a0..1d330b6 100644 --- a/apps/include/netutils/libcoap/config.h +++ b/apps/include/netutils/libcoap/config.h @@ -19,6 +19,31 @@ /* config.h.in. Generated from configure.in by autoheader. */ /******************************************************** + * Tinyara defined configuration + *********************************************************/ +#include + +/* Default Configuration : WITH_POSIX and WITH_TCP */ +#define WITH_POSIX +#define WITH_TCP + +#ifndef __TINYARA__ +#define __TINYARA__ +#endif + +#ifndef CONFIG_NETUTILS_LIBCOAP_DEBUG +#define NDEBUG +#else +#undef NDEBUG +#endif + +#ifdef CONFIG_NET_SECURITY_TLS +#define WITH_MBEDTLS +#else +#undef WITH_MBEDTLS +#endif + +/******************************************************** * User defined configuration (via Kconfig) *********************************************************/ /* Define if building universal (internal helper macro) */ diff --git a/apps/include/netutils/libcoap/debug.h b/apps/include/netutils/libcoap/debug.h index e62d273..85c2e28 100644 --- a/apps/include/netutils/libcoap/debug.h +++ b/apps/include/netutils/libcoap/debug.h @@ -86,6 +86,7 @@ size_t coap_print_addr(const struct coap_address_t *, unsigned char *, size_t); #define warn(...) #define coap_show_pdu(x) +#define coap_show_pdu2(x) #define coap_print_addr(...) #endif diff --git a/apps/include/netutils/libcoap/encode.h b/apps/include/netutils/libcoap/encode.h index 62e7002..bc6eda3 100644 --- a/apps/include/netutils/libcoap/encode.h +++ b/apps/include/netutils/libcoap/encode.h @@ -26,7 +26,7 @@ #ifndef _COAP_ENCODE_H_ #define _COAP_ENCODE_H_ -#include +#include #if defined (__TINYARA__) #include diff --git a/apps/include/netutils/libcoap/lwippools.h b/apps/include/netutils/libcoap/lwippools.h deleted file mode 100644 index 4c9c8e3..0000000 --- a/apps/include/netutils/libcoap/lwippools.h +++ /dev/null @@ -1,35 +0,0 @@ -/** Memory pool definitions for the libcoap when used with lwIP (which has its - * own mechanism for quickly allocating chunks of data with known sizes). Has - * to be findable by lwIP (ie. an #include must either directly - * include this or include something more generic which includes this), and - * MEMP_USE_CUSTOM_POOLS has to be set in lwipopts.h. */ - -#include -#include -#include - -#ifndef MEMP_NUM_COAPCONTEXT -#define MEMP_NUM_COAPCONTEXT 1 -#endif - -#ifndef MEMP_NUM_COAPNODE -#define MEMP_NUM_COAPNODE 4 -#endif - -#ifndef MEMP_NUM_COAP_SUBSCRIPTION -#define MEMP_NUM_COAP_SUBSCRIPTION 4 -#endif - -#ifndef MEMP_NUM_COAPRESOURCE -#define MEMP_NUM_COAPRESOURCE 10 -#endif - -#ifndef MEMP_NUM_COAPRESOURCEATTR -#define MEMP_NUM_COAPRESOURCEATTR 20 -#endif - -LWIP_MEMPOOL(COAP_CONTEXT, MEMP_NUM_COAPCONTEXT, sizeof(coap_context_t), "COAP_CONTEXT") -LWIP_MEMPOOL(COAP_NODE, MEMP_NUM_COAPNODE, sizeof(coap_queue_t), "COAP_NODE") -LWIP_MEMPOOL(COAP_subscription, MEMP_NUM_COAP_SUBSCRIPTION, sizeof(coap_subscription_t), "COAP_subscription") -LWIP_MEMPOOL(COAP_RESOURCE, MEMP_NUM_COAPRESOURCE, sizeof(coap_resource_t), "COAP_RESOURCE") -LWIP_MEMPOOL(COAP_RESOURCEATTR, MEMP_NUM_COAPRESOURCEATTR, sizeof(coap_attr_t), "COAP_RESOURCEATTR") diff --git a/apps/netutils/libcoap/Makefile b/apps/netutils/libcoap/Makefile index 780a34e..aa033f4 100644 --- a/apps/netutils/libcoap/Makefile +++ b/apps/netutils/libcoap/Makefile @@ -79,18 +79,6 @@ COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) OBJS = $(AOBJS) $(COBJS) -# libcoap flags -CFLAGS += -DWITH_POSIX -CFLAGS += -D__TINYARA__ -ifeq ($(CONFIG_NETUTILS_LIBCOAP_DEBUG),n) -CFLAGS += -DNDEBUG -endif -ifeq ($(CONFIG_NET_SECURITY_TLS),y) -CFLAGS += -DWITH_MBEDTLS -endif -CFLAGS += -DWITH_TCP -#CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(APPDIR)$(DELIM)include$(DELIM)netutils$(DELIM)libcoap} - ifeq ($(CONFIG_WINDOWS_NATIVE),y) BIN = ..\..\libapps$(LIBEXT) else -- 2.7.4