From 2fd6fa1fd6be64eada54c1fd3b4f7d91f78d2711 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Mon, 18 Dec 2017 07:58:17 -0800 Subject: [PATCH] Automatically compile .c files from PROJECTDIRS --- Makefile.include | 1 + examples/coap/Makefile | 18 +++++------------- .../res-plugtest-create1.c | 0 .../res-plugtest-create2.c | 0 .../res-plugtest-create3.c | 0 .../res-plugtest-large-create.c | 0 .../res-plugtest-large-update.c | 0 .../res-plugtest-large.c | 0 .../res-plugtest-links.c | 0 .../res-plugtest-locquery.c | 0 .../res-plugtest-longpath.c | 0 .../res-plugtest-multi.c | 0 .../res-plugtest-obs.c | 0 .../res-plugtest-path.c | 0 .../res-plugtest-query.c | 0 .../res-plugtest-separate.c | 0 .../res-plugtest-test.c | 0 .../res-plugtest-validate.c | 0 .../cc26xx/cc26xx-web-demo/Makefile | 8 +------- .../jn516x/rpl/coap-dongle-node/Makefile | 1 - .../jn516x/rpl/coap-dr1175-node/Makefile | 1 - .../jn516x/rpl/coap-dr1199-node/Makefile | 1 - .../platform-specific/jn516x/rpl/node/Makefile | 1 - .../tsch/simple-sensor-network/node/Makefile | 1 - .../tsch/tx-power-verification/node/Makefile | 1 - .../rpl-border-router/Makefile | 1 - .../jn516x/tsch/uart1-test-node/Makefile | 1 - .../nrf52dk/coap-demo/Makefile | 6 +----- examples/rpl-border-router/Makefile | 1 - examples/rpl-border-router/embedded/Makefile | 4 ---- examples/rpl-border-router/native/Makefile | 4 ---- examples/slip-radio/sky/Makefile.sky | 3 --- 32 files changed, 8 insertions(+), 45 deletions(-) rename examples/coap/{resources => resources-plugtest}/res-plugtest-create1.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-create2.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-create3.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-large-create.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-large-update.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-large.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-links.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-locquery.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-longpath.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-multi.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-obs.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-path.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-query.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-separate.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-test.c (100%) rename examples/coap/{resources => resources-plugtest}/res-plugtest-validate.c (100%) diff --git a/Makefile.include b/Makefile.include index c7c191f03..d6753ad6c 100644 --- a/Makefile.include +++ b/Makefile.include @@ -58,6 +58,7 @@ oname = ${patsubst %.c,%.o,${patsubst %.S,%.o,$(1)}} CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFILES)}} +PROJECT_SOURCEFILES += ${foreach d, $(PROJECTDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}} PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}} # Provide way to create $(OBJECTDIR) if it has been removed by make clean diff --git a/examples/coap/Makefile b/examples/coap/Makefile index 1c8f2d21e..8b0cc3b7a 100644 --- a/examples/coap/Makefile +++ b/examples/coap/Makefile @@ -3,20 +3,12 @@ all: coap-example-server coap-example-client CONTIKI=../.. -# automatically build RESTful resources -REST_RESOURCES_DIR = ./resources -ifndef TARGET -REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c')) -else -ifeq ($(TARGET), native) -REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c')) -else -REST_RESOURCES_FILES = $(notdir $(shell find $(REST_RESOURCES_DIR) -name '*.c' ! -name 'res-plugtest*')) +# build RESTful resources +include $(CONTIKI)/Makefile.identify-target +ifeq ($(TARGET),native) + PROJECTDIRS += ./resources-plugtest endif -endif - -PROJECTDIRS += $(REST_RESOURCES_DIR) -PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES) +PROJECTDIRS += ./resources # Include the CoAP implementation MODULES += os/net/app-layer/coap diff --git a/examples/coap/resources/res-plugtest-create1.c b/examples/coap/resources-plugtest/res-plugtest-create1.c similarity index 100% rename from examples/coap/resources/res-plugtest-create1.c rename to examples/coap/resources-plugtest/res-plugtest-create1.c diff --git a/examples/coap/resources/res-plugtest-create2.c b/examples/coap/resources-plugtest/res-plugtest-create2.c similarity index 100% rename from examples/coap/resources/res-plugtest-create2.c rename to examples/coap/resources-plugtest/res-plugtest-create2.c diff --git a/examples/coap/resources/res-plugtest-create3.c b/examples/coap/resources-plugtest/res-plugtest-create3.c similarity index 100% rename from examples/coap/resources/res-plugtest-create3.c rename to examples/coap/resources-plugtest/res-plugtest-create3.c diff --git a/examples/coap/resources/res-plugtest-large-create.c b/examples/coap/resources-plugtest/res-plugtest-large-create.c similarity index 100% rename from examples/coap/resources/res-plugtest-large-create.c rename to examples/coap/resources-plugtest/res-plugtest-large-create.c diff --git a/examples/coap/resources/res-plugtest-large-update.c b/examples/coap/resources-plugtest/res-plugtest-large-update.c similarity index 100% rename from examples/coap/resources/res-plugtest-large-update.c rename to examples/coap/resources-plugtest/res-plugtest-large-update.c diff --git a/examples/coap/resources/res-plugtest-large.c b/examples/coap/resources-plugtest/res-plugtest-large.c similarity index 100% rename from examples/coap/resources/res-plugtest-large.c rename to examples/coap/resources-plugtest/res-plugtest-large.c diff --git a/examples/coap/resources/res-plugtest-links.c b/examples/coap/resources-plugtest/res-plugtest-links.c similarity index 100% rename from examples/coap/resources/res-plugtest-links.c rename to examples/coap/resources-plugtest/res-plugtest-links.c diff --git a/examples/coap/resources/res-plugtest-locquery.c b/examples/coap/resources-plugtest/res-plugtest-locquery.c similarity index 100% rename from examples/coap/resources/res-plugtest-locquery.c rename to examples/coap/resources-plugtest/res-plugtest-locquery.c diff --git a/examples/coap/resources/res-plugtest-longpath.c b/examples/coap/resources-plugtest/res-plugtest-longpath.c similarity index 100% rename from examples/coap/resources/res-plugtest-longpath.c rename to examples/coap/resources-plugtest/res-plugtest-longpath.c diff --git a/examples/coap/resources/res-plugtest-multi.c b/examples/coap/resources-plugtest/res-plugtest-multi.c similarity index 100% rename from examples/coap/resources/res-plugtest-multi.c rename to examples/coap/resources-plugtest/res-plugtest-multi.c diff --git a/examples/coap/resources/res-plugtest-obs.c b/examples/coap/resources-plugtest/res-plugtest-obs.c similarity index 100% rename from examples/coap/resources/res-plugtest-obs.c rename to examples/coap/resources-plugtest/res-plugtest-obs.c diff --git a/examples/coap/resources/res-plugtest-path.c b/examples/coap/resources-plugtest/res-plugtest-path.c similarity index 100% rename from examples/coap/resources/res-plugtest-path.c rename to examples/coap/resources-plugtest/res-plugtest-path.c diff --git a/examples/coap/resources/res-plugtest-query.c b/examples/coap/resources-plugtest/res-plugtest-query.c similarity index 100% rename from examples/coap/resources/res-plugtest-query.c rename to examples/coap/resources-plugtest/res-plugtest-query.c diff --git a/examples/coap/resources/res-plugtest-separate.c b/examples/coap/resources-plugtest/res-plugtest-separate.c similarity index 100% rename from examples/coap/resources/res-plugtest-separate.c rename to examples/coap/resources-plugtest/res-plugtest-separate.c diff --git a/examples/coap/resources/res-plugtest-test.c b/examples/coap/resources-plugtest/res-plugtest-test.c similarity index 100% rename from examples/coap/resources/res-plugtest-test.c rename to examples/coap/resources-plugtest/res-plugtest-test.c diff --git a/examples/coap/resources/res-plugtest-validate.c b/examples/coap/resources-plugtest/res-plugtest-validate.c similarity index 100% rename from examples/coap/resources/res-plugtest-validate.c rename to examples/coap/resources-plugtest/res-plugtest-validate.c diff --git a/examples/platform-specific/cc26xx/cc26xx-web-demo/Makefile b/examples/platform-specific/cc26xx/cc26xx-web-demo/Makefile index 88b4b0184..bc8fd02ca 100644 --- a/examples/platform-specific/cc26xx/cc26xx-web-demo/Makefile +++ b/examples/platform-specific/cc26xx/cc26xx-web-demo/Makefile @@ -1,12 +1,6 @@ all: cc26xx-web-demo -REST_RESOURCES_DIR = ./resources - -REST_RESOURCES_FILES += res-leds.c res-toggle-leds.c res-device.c -REST_RESOURCES_FILES += res-sensors.c res-ble-advd.c res-net.c - -PROJECTDIRS += $(REST_RESOURCES_DIR) -PROJECT_SOURCEFILES += $(REST_RESOURCES_FILES) +PROJECTDIRS += ./resources PROJECT_SOURCEFILES += cetic-6lbr-client.c coap-server.c net-uart.c mqtt-client.c PROJECT_SOURCEFILES += httpd-simple.c diff --git a/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile index 1b13ef3e0..68dfc3104 100644 --- a/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile +++ b/examples/platform-specific/jn516x/rpl/coap-dongle-node/Makefile @@ -9,7 +9,6 @@ CONTIKI=../../../../.. MAKE_MAC = MAKE_MAC_TSCH MODULES += os/lib/json PROJECTDIRS += .. ../tools -PROJECT_SOURCEFILES += rpl-tools.c MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile index 9a393ff14..8ff775250 100644 --- a/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile +++ b/examples/platform-specific/jn516x/rpl/coap-dr1175-node/Makefile @@ -9,7 +9,6 @@ CONTIKI=../../../../.. MAKE_MAC = MAKE_MAC_TSCH MODULES += os/lib/json PROJECTDIRS += .. ../tools -PROJECT_SOURCEFILES += rpl-tools.c MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile index 32231f636..dc8ee8490 100644 --- a/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile +++ b/examples/platform-specific/jn516x/rpl/coap-dr1199-node/Makefile @@ -9,7 +9,6 @@ CONTIKI=../../../../.. MAKE_MAC = MAKE_MAC_TSCH MODULES += os/lib/json PROJECTDIRS += .. ../tools -PROJECT_SOURCEFILES += rpl-tools.c MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/jn516x/rpl/node/Makefile b/examples/platform-specific/jn516x/rpl/node/Makefile index 37f6c7c79..d581bb235 100644 --- a/examples/platform-specific/jn516x/rpl/node/Makefile +++ b/examples/platform-specific/jn516x/rpl/node/Makefile @@ -7,6 +7,5 @@ CONTIKI=../../../../.. MAKE_MAC = MAKE_MAC_TSCH PROJECTDIRS += .. ../tools -PROJECT_SOURCEFILES += rpl-tools.c include $(CONTIKI)/Makefile.include diff --git a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile index df37a89af..691dc94ec 100644 --- a/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile +++ b/examples/platform-specific/jn516x/tsch/simple-sensor-network/node/Makefile @@ -6,7 +6,6 @@ JN516x_WITH_DONGLE = 1 CONTIKI=../../../../../.. PROJECTDIRS += .. ../../tools -PROJECT_SOURCEFILES += rpl-tools.c MAKE_MAC = MAKE_MAC_TSCH MODULES += os/net/app-layer/coap MODULES += os/services/orchestra os/lib/json diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile b/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile index 977210702..b4846ed91 100644 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile +++ b/examples/platform-specific/jn516x/tsch/tx-power-verification/node/Makefile @@ -6,7 +6,6 @@ JN516x_WITH_DONGLE = 1 CONTIKI=../../../../../.. PROJECTDIRS += .. ../../tools -PROJECT_SOURCEFILES += rpl-tools.c MAKE_MAC = MAKE_MAC_TSCH MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/jn516x/tsch/tx-power-verification/rpl-border-router/Makefile b/examples/platform-specific/jn516x/tsch/tx-power-verification/rpl-border-router/Makefile index c88fa5a2b..b3b1fd9a4 100644 --- a/examples/platform-specific/jn516x/tsch/tx-power-verification/rpl-border-router/Makefile +++ b/examples/platform-specific/jn516x/tsch/tx-power-verification/rpl-border-router/Makefile @@ -8,7 +8,6 @@ CONTIKI=../../../../../.. PROJECT_SOURCEFILES += slip-bridge.c slip.c PROJECTDIRS += .. ../../tools -PROJECT_SOURCEFILES += rpl-tools.c MAKE_MAC = MAKE_MAC_TSCH MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile b/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile index ca520969d..fdd38cc9e 100644 --- a/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile +++ b/examples/platform-specific/jn516x/tsch/uart1-test-node/Makefile @@ -7,7 +7,6 @@ TARGET_WITH_UART1 = 1 CONTIKI=../../../../.. PROJECTDIRS += .. ../tools -PROJECT_SOURCEFILES += rpl-tools.c MAKE_MAC = MAKE_MAC_TSCH MODULES += os/net/app-layer/coap diff --git a/examples/platform-specific/nrf52dk/coap-demo/Makefile b/examples/platform-specific/nrf52dk/coap-demo/Makefile index 6d9639da0..02f87b5d6 100644 --- a/examples/platform-specific/nrf52dk/coap-demo/Makefile +++ b/examples/platform-specific/nrf52dk/coap-demo/Makefile @@ -16,11 +16,7 @@ CFLAGS += -DDEVICE_NAME=\"nRF52-DK-CoAP-Server\" endif # 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) +PROJECTDIRS += ./resources # REST Engine shall use Erbium CoAP implementation MODULES += os/net/app-layer/coap diff --git a/examples/rpl-border-router/Makefile b/examples/rpl-border-router/Makefile index 76c07cb8b..aaa8ab6cf 100644 --- a/examples/rpl-border-router/Makefile +++ b/examples/rpl-border-router/Makefile @@ -15,7 +15,6 @@ endif include $(SOURCES_DIR)/Makefile PROJECTDIRS += $(SOURCES_DIR) -PROJECT_SOURCEFILES += httpd-simple.c webserver.c border-router-common.c CFLAGS += -DPROJECT_CONF_PATH=\"$(SOURCES_DIR)/project-conf.h\" include $(CONTIKI)/Makefile.include diff --git a/examples/rpl-border-router/embedded/Makefile b/examples/rpl-border-router/embedded/Makefile index 5faba70c8..8c899e8b1 100644 --- a/examples/rpl-border-router/embedded/Makefile +++ b/examples/rpl-border-router/embedded/Makefile @@ -2,10 +2,6 @@ ### add more source files to the build or define make variables. -include $(SOURCES_DIR)/$(TARGET)/Makefile.$(TARGET) -PROJECTDIRS += $(SOURCES_DIR)/$(TARGET) - -PROJECT_SOURCEFILES += slip-bridge.c border-router-embedded.c - $(CONTIKI)/tools/tunslip6: $(CONTIKI)/tools/tunslip6.c (cd $(CONTIKI)/tools && $(MAKE) tunslip6) diff --git a/examples/rpl-border-router/native/Makefile b/examples/rpl-border-router/native/Makefile index 30690df0f..f04626c8e 100644 --- a/examples/rpl-border-router/native/Makefile +++ b/examples/rpl-border-router/native/Makefile @@ -1,9 +1,5 @@ MODULES += os/services/slip-cmd -PROJECT_SOURCEFILES += border-router-native.c -PROJECT_SOURCEFILES += border-router-cmds.c tun-bridge.c -PROJECT_SOURCEFILES += slip-config.c slip-dev.c border-router-mac.c - MAKE_MAC = MAKE_MAC_OTHER MAKE_NET = MAKE_NET_IPV6 diff --git a/examples/slip-radio/sky/Makefile.sky b/examples/slip-radio/sky/Makefile.sky index 83a91472d..17fefd5ee 100644 --- a/examples/slip-radio/sky/Makefile.sky +++ b/examples/slip-radio/sky/Makefile.sky @@ -1,4 +1 @@ -PROJECT_SOURCEFILES += slip-radio-cc2420.c slip-radio-sky-sensors.c -PROJECT_SOURCEFILES += slip-radio-putchar.c - CFLAGS += -DTARGET_CONF_PATH=\"target-conf.h\"