Skip to content
Snippets Groups Projects
Unverified Commit 7fe9f889 authored by George Oikonomou's avatar George Oikonomou Committed by GitHub
Browse files

Merge pull request #915 from g-oikonomou/bugfix/build/module-improvements

Improve MODULE dependency handling
parents c2617b6e e930ec5e
No related branches found
No related tags found
No related merge requests found
...@@ -69,7 +69,7 @@ ifneq ("$(wildcard project-conf.h)","") ...@@ -69,7 +69,7 @@ ifneq ("$(wildcard project-conf.h)","")
CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\" CFLAGS += -DPROJECT_CONF_PATH=\"project-conf.h\"
endif 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 define oname
${patsubst %.c,%.o, \ ${patsubst %.c,%.o, \
...@@ -227,20 +227,27 @@ else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING) ...@@ -227,20 +227,27 @@ else ifeq ($(MAKE_ROUTING),MAKE_ROUTING_NULLROUTING)
MODULES += os/net/routing/nullrouting MODULES += os/net/routing/nullrouting
endif endif
MODULEDIRS = $(MODULES_REL) ${wildcard ${addprefix $(CONTIKI)/, $(MODULES)}} MODULEDIRS = $(MODULES_REL) ${addprefix $(CONTIKI)/, $(MODULES)}
UNIQUEMODULES = $(call uniq,$(MODULEDIRS)) 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) CONTIKI_SOURCEFILES += $(MODULES_SOURCES)
# Include module-specific makefiles # Include module-specific makefiles
MODULES_INCLUDES = ${wildcard ${foreach d, $(MODULEDIRS), $(d)/Makefile.${notdir $(d)}}} MODULES_INCLUDES = ${wildcard ${foreach d, $(UNIQUEMODULES), $(d)/Makefile.${notdir $(d)}}}
include $(MODULES_INCLUDES)
### 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. # Iterate once more: include the modules added from the previous include.
# Only works with one level of nested module inclusion. # 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 # 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),) ifneq ($(MODULES_IMACROS),)
CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)} CFLAGS += ${foreach d, $(MODULES_IMACROS), -imacros $(d)}
endif endif
......
CFLAGS += -DBUILD_WITH_SHELL=1
#define BUILD_WITH_SHELL 1
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment