From 3d2788d4c60739ef8f00c65ff925d87754c7d58a Mon Sep 17 00:00:00 2001 From: Atis Elsts Date: Fri, 23 Feb 2018 17:35:41 +0000 Subject: [PATCH] Reorganize the nrf52dk/coap-demo example to make it compatible with the new build system --- .../nrf52dk/coap-demo/Makefile | 26 ------------------- .../nrf52dk/coap-demo/coap-client/Makefile | 26 +++++++++++++++++++ .../{ => coap-client}/Makefile.target | 0 .../coap-demo/{ => coap-client}/coap-client.c | 0 .../nrf52dk/coap-demo/coap-server/Makefile | 22 ++++++++++++++++ .../coap-demo/coap-server/Makefile.target | 1 + .../coap-demo/{ => coap-server}/coap-server.c | 0 7 files changed, 49 insertions(+), 26 deletions(-) delete mode 100644 examples/platform-specific/nrf52dk/coap-demo/Makefile create mode 100644 examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile rename examples/platform-specific/nrf52dk/coap-demo/{ => coap-client}/Makefile.target (100%) rename examples/platform-specific/nrf52dk/coap-demo/{ => coap-client}/coap-client.c (100%) create mode 100644 examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile create mode 100644 examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target rename examples/platform-specific/nrf52dk/coap-demo/{ => coap-server}/coap-server.c (100%) diff --git a/examples/platform-specific/nrf52dk/coap-demo/Makefile b/examples/platform-specific/nrf52dk/coap-demo/Makefile deleted file mode 100644 index 39692524d..000000000 --- a/examples/platform-specific/nrf52dk/coap-demo/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -CONTIKI=../../../.. - -ifeq ($(MAKECMDGOALS),) -$(error Please specify whether coap-client or coap-server should be built) -endif - -ifneq ($(filter coap-client coap-client.flash, $(MAKECMDGOALS)),) -ifeq ($(SERVER_IPV6_EP),) -$(error Please define SERVER_IPV6_EP=) -else -CFLAGS += -DSERVER_IPV6_EP=\"$(SERVER_IPV6_EP)\" -CFLAGS += -DDEVICE_NAME=\"nRF52_DK_CoAP_Client\" -endif -else -CFLAGS += -DDEVICE_NAME=\"nRF52-DK-CoAP-Server\" -endif - -# automatically build RESTful resources -MODULES_REL += ./resources - -# REST Engine shall use Erbium CoAP implementation -MODULES += os/net/app-layer/coap - -MAKE_ROUTING = MAKE_ROUTING_NULLROUTING - -include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile b/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile new file mode 100644 index 000000000..940707151 --- /dev/null +++ b/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile @@ -0,0 +1,26 @@ +CONTIKI_PROJECT = coap-client +CONTIKI=../../../../.. + +PLATFORMS_ONLY = nrf52dk + +ifeq ($(SERVER_IPV6_EP),) +$(warning Please define SERVER_IPV6_EP=) +$(warning Using default SERVER_IPV6_EP=fd00::1) +SERVER_IPV6_EP=fd00::1 +endif + +CFLAGS += -DDEVICE_NAME=\"nRF52_DK_CoAP_Client\" + +CFLAGS += -DCOAP_OBSERVE_CLIENT=1 + +# automatically build RESTful resources +MODULES_REL += ./resources + +# REST Engine shall use Erbium CoAP implementation +MODULES += os/net/app-layer/coap + +MAKE_ROUTING = MAKE_ROUTING_NULLROUTING + +all: $(CONTIKI_PROJECT) + +include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/coap-demo/Makefile.target b/examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile.target similarity index 100% rename from examples/platform-specific/nrf52dk/coap-demo/Makefile.target rename to examples/platform-specific/nrf52dk/coap-demo/coap-client/Makefile.target diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-client.c b/examples/platform-specific/nrf52dk/coap-demo/coap-client/coap-client.c similarity index 100% rename from examples/platform-specific/nrf52dk/coap-demo/coap-client.c rename to examples/platform-specific/nrf52dk/coap-demo/coap-client/coap-client.c diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile new file mode 100644 index 000000000..c42c61d52 --- /dev/null +++ b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile @@ -0,0 +1,22 @@ +CONTIKI_PROJECT = coap-server +CONTIKI=../../../../.. + +PLATFORMS_ONLY = nrf52dk + +CFLAGS += -DDEVICE_NAME=\"nRF52-DK-CoAP-Server\" + +# automatically build RESTful resources +REST_RESOURCES_DIR = ../resources +REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c' ! -name 'res-plugtest*')) + +PROJECTDIRS += $(REST_RESOURCES_DIR) +PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES) + +# REST Engine shall use Erbium CoAP implementation +MODULES += os/net/app-layer/coap + +MAKE_ROUTING = MAKE_ROUTING_NONE + +all: $(CONTIKI_PROJECT) + +include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target new file mode 100644 index 000000000..3853b313a --- /dev/null +++ b/examples/platform-specific/nrf52dk/coap-demo/coap-server/Makefile.target @@ -0,0 +1 @@ +TARGET = nrf52dk diff --git a/examples/platform-specific/nrf52dk/coap-demo/coap-server.c b/examples/platform-specific/nrf52dk/coap-demo/coap-server/coap-server.c similarity index 100% rename from examples/platform-specific/nrf52dk/coap-demo/coap-server.c rename to examples/platform-specific/nrf52dk/coap-demo/coap-server/coap-server.c