Skip to content

Build dependencies - processing order issues #9913

@cladmi

Description

@cladmi

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

Prerequisites cleanup

And even future improvement to remove multiple duplication between board/board_common cpu/cpu_common path:

  • With BOARD and CPU recursively including their Makefile.board and Makefile.cpu, define some BOARD_IMPLEMENTATION_DIRS like variables that can be re-used to remove duplication in Makefile, 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.

Metadata

Metadata

Assignees

Labels

Area: build systemArea: Build systemDiscussion: RFCThe issue/PR is used as a discussion starting point about the item of the issue/PRState: WIPState: The PR is still work-in-progress and its code is not in its final presentable form yetType: bugThe issue reports a bug / The PR fixes a bug (including spelling errors)Type: trackingThe issue tracks and organizes the sub-tasks of a larger effort

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions