Skip to content

build-system: introduce MODULE_DEFS_NEEDED list - #22561

Draft
maribu wants to merge 1 commit into
RIOT-OS:masterfrom
maribu:build-system/add-module-defs-needed
Draft

build-system: introduce MODULE_DEFS_NEEDED list#22561
maribu wants to merge 1 commit into
RIOT-OS:masterfrom
maribu:build-system/add-module-defs-needed

Conversation

@maribu

@maribu maribu commented Aug 11, 2026

Copy link
Copy Markdown
Member

Contribution description

  • do not unconditionally expose every module foo via CFLAGS += -DMODULE_FOO
    • instead, only expose listed in MODULE_DEFS_NEEDED
    • do so globally when listed in Makefile.include
    • do so locally (only C files within the module) when listed in Makefile
  • modules listed in MODULE_DEFS_NEEDED will be added with CFLAGS += -DMODULE_FOO=1 if used, or CFLAGS += -DMODULE_FOO=0 if not used
    • This makes IS_USED() pointless. In fact, it will even hide the fact that a module is not listed in MODULE_DEFS_NEEDED but tested for
    • dreprecate IS_USED() and define it as #define IS_USED(x) x to ensure missing MODULE_DEFS_NEEDED declarations cause compilation errors

Testing procedure

Everything builds as before, same binaries as before.

Issues/PRs references

None

Declaration of AI-Tools / LLMs usage:

AI-Tools / LLMs that were used are:

  • a python script to modify Makefile and Makefile.include based on instances of MODULE_[A-Z0-9_]+ in *.c and *.h was mostly vibed
  • otherwise none

- do not unconditionally expose every module `foo` via
  `CFLAGS += -DMODULE_FOO`
  - instead, only expose listed in `MODULE_DEFS_NEEDED`
  - do so globally when listed in `Makefile.include`
  - do so locally (only C files within the module) when listed in
    `Makefile`
- modules listed in `MODULE_DEFS_NEEDED` will be added with
  `CFLAGS += -DMODULE_FOO=1` if used, or `CFLAGS += -DMODULE_FOO=0` if
  not used
  - This makes `IS_USED()` pointless. In fact, it will even hide the
    fact that a module is not listed in `MODULE_DEFS_NEEDED` but
    tested for
  - dreprecate `IS_USED()` and define it as `#define IS_USED(x) x` to
    ensure missing `MODULE_DEFS_NEEDED` declarations cause compilation
    errors
@maribu maribu added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Aug 11, 2026
@github-actions github-actions Bot added Platform: native Platform: This PR/issue effects the native platform Platform: MSP Platform: This PR/issue effects MSP-based platforms Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: network Area: Networking Area: doc Area: Documentation Area: tests Area: tests and testing framework Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: build system Area: Build system Area: pkg Area: External package ports Platform: AVR Platform: This PR/issue effects AVR-based platforms Area: drivers Area: Device drivers Area: BLE Area: Bluetooth Low Energy support Area: timers Area: timer subsystems Area: arduino API Area: Arduino wrapper API Area: LoRa Area: LoRa radio support Area: boards Area: Board ports Area: SAUL Area: Sensor/Actuator Uber Layer Area: OTA Area: Over-the-air updates Platform: ESP Platform: This PR/issue effects ESP-based platforms Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms Area: CoAP Area: Constrained Application Protocol implementations Area: cpu Area: CPU/MCU ports Area: USB Area: Universal Serial Bus Area: sys Area: System Area: examples Area: Example Applications labels Aug 11, 2026
@riot-ci

riot-ci commented Aug 11, 2026

Copy link
Copy Markdown

Murdock results

FAILED

4cda652 build-system: introduce MODULE_DEFS_NEEDED list

Success Failures Total Runtime
413 499 10255 03m:35s
Build failures (21)
Application Target Toolchain Runtime (s) Worker
examples/networking/misc/benchmark_udp native64 gnu 0.58 mobi5
tests/core/thread_float msba2 gnu 0.85 mobi1
tests/core/thread_float native32 gnu 0.85 mobi6
tests/core/thread_float msb-430 gnu 0.77 mobi6
tests/core/thread_float native64 gnu 0.98 mobi7
tests/core/thread_float hifive1b gnu 0.84 mobi5
tests/core/thread_float native32 llvm 0.85 mobi1
tests/pkg/umorse native64 gnu 1.24 mobi1
tests/pkg/umorse msba2 gnu 0.75 mobi6
tests/pkg/umorse native32 gnu 1.79 riot-ci
tests/pkg/umorse native32 llvm 1.03 mobi6
tests/sys/cpp11_mutex native32 gnu 0.82 mobi7
tests/sys/cpp11_mutex native64 llvm 1.27 mobi5
tests/sys/cpp11_mutex native64 gnu 1.81 mobi3
tests/sys/cpp11_mutex msba2 gnu 1.22 mobi6
tests/sys/ztimer_ondemand_benchmark native32 gnu 0.71 mobi5
tests/sys/ztimer_ondemand_benchmark native64 gnu 0.46 mobi5
tests/sys/ztimer_ondemand_benchmark native64 llvm 0.74 mobi6
tests/sys/ztimer_ondemand_benchmark msb-430 gnu 1.08 mobi3
tests/sys/ztimer_ondemand_benchmark native32 llvm 0.99 mobi3

and 479 more build failures...

Artifacts

@crasbe crasbe added the CI: no fast fail don't abort PR build after first error label Aug 11, 2026
@AnnsAnns AnnsAnns added the AI: Helped PR/Issue uses AI sparingly, e.g. code inline assistant, debugging with AI, etc. label Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Helped PR/Issue uses AI sparingly, e.g. code inline assistant, debugging with AI, etc. Area: arduino API Area: Arduino wrapper API Area: BLE Area: Bluetooth Low Energy support Area: boards Area: Board ports Area: build system Area: Build system Area: CoAP Area: Constrained Application Protocol implementations Area: core Area: RIOT kernel. Handle PRs marked with this with care! Area: cpu Area: CPU/MCU ports Area: doc Area: Documentation Area: drivers Area: Device drivers Area: examples Area: Example Applications Area: LoRa Area: LoRa radio support Area: network Area: Networking Area: OTA Area: Over-the-air updates Area: pkg Area: External package ports Area: SAUL Area: Sensor/Actuator Uber Layer Area: sys Area: System Area: tests Area: tests and testing framework Area: timers Area: timer subsystems Area: USB Area: Universal Serial Bus CI: no fast fail don't abort PR build after first error CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms Platform: AVR Platform: This PR/issue effects AVR-based platforms Platform: ESP Platform: This PR/issue effects ESP-based platforms Platform: MSP Platform: This PR/issue effects MSP-based platforms Platform: native Platform: This PR/issue effects the native platform Platform: RISC-V Platform: This PR/issue effects RISC-V-based platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants