diff --git a/Makefile.base b/Makefile.base index 5469d5c117..53f858e99a 100644 --- a/Makefile.base +++ b/Makefile.base @@ -89,10 +89,7 @@ include $(RIOTMAKE)/tools/fixdep.inc.mk $(BINDIR)/$(MODULE)/: $(Q)mkdir -p $@ -# only create the module folder when it's going to hold objects -ifneq (,$(strip $(OBJ))) - $(MODULE).module $(OBJ): | $(BINDIR)/$(MODULE)/ -endif +$(MODULE).module $(OBJ): | $(BINDIR)/$(MODULE)/ $(MODULE).module: $(OBJ) | $(DIRS:%=ALL--%) diff --git a/Makefile.include b/Makefile.include index 165b4cf314..1ef4458753 100644 --- a/Makefile.include +++ b/Makefile.include @@ -556,6 +556,7 @@ DIRS += $(EXTERNAL_MODULE_DIRS) BUILDDEPS += $(RIOTBUILD_CONFIG_HEADER_C) BUILDDEPS += pkg-prepare BUILDDEPS += $(APPDEPS) +BUILDDEPS += $(MODULE_LIST_DIR) # Save value to verify it is not modified later _BASELIBS_VALUE_BEFORE_USAGE := $(BASELIBS) @@ -575,9 +576,9 @@ ifeq ($(BUILD_IN_DOCKER),1) link: ..in-docker-container else ifeq (,$(RIOTNOLINK)) -link: ..compiler-check ..build-message $(BUILD_FILES) print-size +link: ..compiler-check ..build-message $(BUILD_FILES) print-size ..module-check else -link: ..compiler-check ..build-message $(BASELIBS) $(ARCHIVES) +link: ..compiler-check ..build-message $(BASELIBS) $(ARCHIVES) ..module-check endif # RIOTNOLINK $(ELFFILE): $(BASELIBS) $(ARCHIVES) @@ -585,6 +586,10 @@ $(ELFFILE): $(BASELIBS) $(ARCHIVES) .PHONY: $(APPLICATION_MODULE).module +..module-check: $(BASELIBS) + @[ -z "$(strip $(NON_GENERATED_MODULES))" ] || \ + ($(COLOR_ECHO) "$(COLOR_RED)Error - using unknown modules: $(COLOR_RESET)$(NON_GENERATED_MODULES)" && false) + $(APPLICATION_MODULE).module: pkg-build $(BUILDDEPS) $(Q)DIRS="$(DIRS)" APPLICATION_BLOBS="$(BLOBS)" \ "$(MAKE)" -C $(APPDIR) -f $(RIOTMAKE)/application.inc.mk diff --git a/makefiles/modules.inc.mk b/makefiles/modules.inc.mk index 55595b5d37..4595d8d062 100644 --- a/makefiles/modules.inc.mk +++ b/makefiles/modules.inc.mk @@ -12,3 +12,8 @@ EXTDEFINES = $(addprefix -D,$(call uppercase_and_underscore,$(ED))) REALMODULES += $(filter-out $(PSEUDOMODULES), $(_ALLMODULES)) REALMODULES += $(filter $(NO_PSEUDOMODULES), $(_ALLMODULES)) BASELIBS += $(REALMODULES:%=%.module) + +# Add modules compiled with Makefile.base and extra archives +GENERATED_MODULES = $(notdir $(shell find $(BINDIR) -type d)) $(basename $(notdir $(ARCHIVES))) + +NON_GENERATED_MODULES = $(filter-out $(GENERATED_MODULES),$(REALMODULES))