Browse Source

make: add submodule support

pr/rotary
Kaspar Schleiser 6 years ago
parent
commit
933a7a3efe
  1. 17
      Makefile.base

17
Makefile.base

@ -22,6 +22,23 @@ ${DIRS:%=ALL--%}:
${DIRS:%=CLEAN--%}:
$(QQ)"$(MAKE)" -C ${@:CLEAN--%=%} clean
## submodules
ifeq (1, $(SUBMODULES))
# don't use *.c as SRC if SRC is empty (e.g., no module selected)
NO_AUTO_SRC := 1
# allow different submodule basename (e.g., MODULE=cpu_periph_common, but match just periph_%)
BASE_MODULE ?= $(MODULE)
# for each $(BASE_MODULE)_<name> in USEMODULE, add <name>.c to SRC
SRC += $(patsubst $(BASE_MODULE)_%,%.c,$(filter $(BASE_MODULE)_%,$(USEMODULE)))
# don't fail if a selected *.c file does not exist
ifeq (1, $(SUBMODULES_NOFORCE))
SRC := $(filter $(SRC), $(wildcard *.c))
endif
endif
ifeq ($(strip $(SRC))$(NO_AUTO_SRC),)
SRC := $(filter-out $(SRC_NOLTO), $(wildcard *.c))
endif

Loading…
Cancel
Save