diff --git a/Makefile.include b/Makefile.include index 4cf00783ba56f405fb7c02e1be3a236103b02828..6ebea14f4bb6266e8d69b5975bc63af819edca1d 100644 --- a/Makefile.include +++ b/Makefile.include @@ -69,7 +69,7 @@ ifneq ("$(wildcard project-conf.h)","") CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\" endif -MODULES += os os/net os/net/mac os/net/mac/framer os/net/routing os/storage +MODULES += os/net os/net/mac os/net/mac/framer os/net/routing os/storage define oname ${patsubst %.c,%.o, \ @@ -227,20 +227,27 @@ else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING) MODULES += os/net/routing/nullrouting endif -MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}} +MODULEDIRS = $(MODULES_REL) ${addprefix $(CONTIKI)/, $(MODULES)} UNIQUEMODULES = $(call uniq,$(MODULEDIRS)) -MODULES_SOURCES = ${foreach d, $(MODULEDIRS), ${subst ${d}/,,${wildcard $(d)/*.c}}} +MODULES_SOURCES = ${foreach d, $(UNIQUEMODULES), ${subst ${d}/,,${wildcard $(d)/*.c}}} CONTIKI_SOURCEFILES += $(MODULES_SOURCES) # Include module-specific makefiles -MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}} -include $(MODULES_INCLUDES) +MODULES_INCLUDES = ${wildcard ${foreach d, $(UNIQUEMODULES), $(d)/Makefile.${notdir $(d)}}} + +### Perform an immediate expansion of MODULES_INCLUDES and store it in a +### variable. This will allow us to subsequently filter-out module Makefiles +### that were included in the first pass, such that we don't end up including +### them twice. +MODULES_INCLUDED_FIRST_PASS := $(MODULES_INCLUDES) +include $(MODULES_INCLUDED_FIRST_PASS) + # Iterate once more: include the modules added from the previous include. # Only works with one level of nested module inclusion. -include $(MODULES_INCLUDES) +include $(filter-out $(MODULES_INCLUDED_FIRST_PASS),$(MODULES_INCLUDES)) # C-include module-specific macros using -imacros -MODULES_IMACROS = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/module-macros.h}} +MODULES_IMACROS = ${wildcard ${foreach d, $(UNIQUEMODULES), $(d)/module-macros.h}} ifneq ($(MODULES_IMACROS),) CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)} endif diff --git a/os/services/shell/Makefile.shell b/os/services/shell/Makefile.shell deleted file mode 100644 index 9b95490182221bcdf362376138f4311348a541a0..0000000000000000000000000000000000000000 --- a/os/services/shell/Makefile.shell +++ /dev/null @@ -1 +0,0 @@ -CFLAGS += -DBUILD_WITH_SHELL=1 diff --git a/os/services/shell/module-macros.h b/os/services/shell/module-macros.h new file mode 100644 index 0000000000000000000000000000000000000000..dc40e1196ad852aaacd7f4f9653613b83daf22a1 --- /dev/null +++ b/os/services/shell/module-macros.h @@ -0,0 +1 @@ +#define BUILD_WITH_SHELL 1