Skip to content

Commit

Permalink
makefile: add a check for real modules
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrolanzieri committed Sep 4, 2020
1 parent 16b5fd3 commit e80bb4b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 1 addition & 4 deletions Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -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--%)

Expand Down
9 changes: 7 additions & 2 deletions Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -575,16 +576,20 @@ 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)
$(Q)$(_LINK) -o $@

.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
Expand Down
5 changes: 5 additions & 0 deletions makefiles/modules.inc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit e80bb4b

Please sign in to comment.