Makefile.base: add SUBMODULE_NO_SRC to excluded a selected SUBMODULE *.c

This allows for SUBMODULE PSEUDOMODULES to conditionally not be linked
to an existing *.c file.
This commit is contained in:
Francisco Molina 2021-11-16 09:22:22 +01:00
parent 3bf4ef88fe
commit cc001a81e1
2 changed files with 7 additions and 2 deletions

View File

@ -45,7 +45,11 @@ ifeq (1, $(SUBMODULES))
BASE_MODULE ?= $(MODULE)
# for each $(BASE_MODULE)_<name> in USEMODULE, add <name>.c to SRC
SRC += $(wildcard $(patsubst $(BASE_MODULE)_%,%.c,$(filter $(BASE_MODULE)_%,$(USEMODULE))))
# unless in SUBMODULES_NO_SRC
SRC += $(wildcard \
$(filter-out $(SUBMODULES_NO_SRC),\
$(patsubst $(BASE_MODULE)_%,%.c,\
$(filter $(BASE_MODULE)_%,$(USEMODULE)))))
# remove duplicates
SRC := $(sort $(SRC))

View File

@ -160,7 +160,8 @@ the only parts of compounded module names and only match against part of that na
See `sys/ztimer/Makefile` for an example in code.
`SUBMODULES` can also be true-pseudomodules.
`SUBMODULES` can also be true-pseudomodules, or become one by conditionally excluding
the source files by adding them to `SUBMODULES_NO_SRC`.
# Helper tools