-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Description
There currently are concurrency issues in the order dependencies are defined and used, and cpu dependencies cannot be easily parsed.
I plan to address this by moving the processing of Makefile.dep before including $(BOARD)/Makefile.include
Dependencies resolution uses the following variables
- USEMODULE
- USEPKG
- FEATURES_
- BOARD
- CPU
- CPU_FAM (which depend on files in CPU)
- CPU_ARCH (which depend on files in CPU)
- CPU_MODEL
Steps
- Fix CPU dependencies not being parsed easily as reported first in Makefile.dep: process cpu dependencies and fix stm32_common #9892
-
Add a new file in board that include the common files too and currently only definesReuseCPU,Makefile.board.Makefile.featuresto defineCPU - Migration of CPU/CPU_MODEL Tracking: move CPU/CPU_MODEL to Makefile.features #11477
- Makefile.features: assert CPU is defined by BOARD/Makefile.features Makefile.features: assert CPU is defined by BOARD/Makefile.features #12417
- Move CPU dependencies to
$(CPU)/Makefile.dep - Fix the
stm32_commonissue described in Makefile.dep: process cpu dependencies and fix stm32_common #9892- Remove them being defined as dependencies
cpu/stm32_common: fix source selection declared as module dependencies (broken) #10153
- Remove them being defined as dependencies
-
- At that point, Makefile.features can be split to directly do
include $(RIOTCPU)/$(CPU)/Makefile.featuresinstead of hardwriting it. - Fix
CPU_FAMandCPU_ARCHdefined inMakefile.includewhen they should be already available forMakefile.dep. Define them inMakefile.cpuMakefile.featuresfiles. - doc: document how to handle multiple cpu_models in a directory doc: document how to handle multiple cpu_models in a directory #12407
- Move all BOARD/CPU dependencies to
$(BOARD)/Makefile.depand$(CPU)/Makefile.dep - Fix other USEMODULE defined in
Makefile.includeissues (can be done in parallel)- USEMODULE += $(SKETCH_MODULE)
/sys/arduino/Makefile.include
- USEMODULE += $(SKETCH_MODULE)
- Move
Makefile.depbefore doingMakefile.include. Makefile.include: resolve dependencies before Makefile.include #14351 - Reorganize files inclusion to be done only when needed
Prerequisites cleanup
- mips-malta including common cpu features board/mips-malta: include the cpu features instead of common cpu #10064
- boards: always include cpu features boards: always include cpu features #10078
- cpu/esp8266 re-defining CPU cpu/esp8266: remove duplicate 'CPU' variable #10061
- hifive1 not processing CPU features boards/hifive1: include cpu/fe310 features #10063
- cpu/fe310: rtc depend on the rtt feature and hifive1 update cpu/fe310: rtc depend on the rtt feature and hifive1 update #10062
- static_tests: add build system checks static_tests: add build system checks #10060
And even future improvement to remove multiple duplication between board/board_common cpu/cpu_common path:
- With BOARD and CPU recursively including their
Makefile.boardandMakefile.cpu, define someBOARD_IMPLEMENTATION_DIRSlike variables that can be re-used to remove duplication inMakefile,Makefile.deps,Makefile.include,Makefile.features.
Explanation
To summarize, the main Makefile.include does regarding modules:
(a more detailed version is available here https://gist.github.com/cladmi/1c5af63c753635b7cb173cf8311d0b5b)
include $(RIOTBOARD)/$(BOARD)/Makefile.features
# Define FEATURES_PROVIDED
# Include with hard written path CPU/Makefile.features
include $(RIOTBOARD)/$(BOARD)/Makefile.include
# Defines CPU
# Defines USEMODULE
# Have specific behavior depending on USEMODULE/USEPKG
include $(RIOTBOARD)/$(CPU)/Makefile.include
# Define USEMODULE
# Have specific behavior depending on USEMODULE/USEPKG
# Define module dependencies
include Makefile.dep
# Resolve USEMODULE/USEPKG/FEATURES_USED using:
# * USEMODULE
# * USEPKG
# * FEATURES_
# * BOARD
# * CPU
# * CPU_FAM
# * CPU_ARCH
include $(RIOTBASE)/sys/Makefile.include
include $(RIOTBASE)/drivers/Makefile.include
-include $(USEPKG:%=$(RIOTPKG)/%/Makefile.include)
include $(RIOTMAKE)/bindist.inc.mk
# These also add things to USEMODULE
The main Makefile.dep only includes $(BOARD)/Makefile.dep which may sometime also end up including hardwritten_cpu_name/Makefile.dep.
In the same time makefiles/info-global.inc.mk does:
include $(RIOTBOARD)/$(BOARD)/Makefile.features
include $(RIOTBASE)/Makefile.dep
And so never takes into account any of the dependencies defined in $(BOARD)/Makefile.include or any other Makeflie.include files.