Skip to content

static-test: Check for Makefile.dep touching CFLAGS#21965

Merged
maribu merged 2 commits intoRIOT-OS:masterfrom
maribu:build-system/check-no-cflags-in-Makefile.dep
Dec 23, 2025
Merged

static-test: Check for Makefile.dep touching CFLAGS#21965
maribu merged 2 commits intoRIOT-OS:masterfrom
maribu:build-system/check-no-cflags-in-Makefile.dep

Conversation

@maribu
Copy link
Copy Markdown
Member

@maribu maribu commented Dec 22, 2025

Contribution description

The Makefile.dep are intended for dependency tracking only. Modifying CFLAGS as part of the dependency resolution process is just wrong.

This extends the build system sanity check to prevent this kind of bug from sneaking in again.

Testing procedure

There are a few offenders in the code base. The CI should flag them now.

I'll add a commit to fix them (and reorder the history to first fix the problem, then detect it, so that bisecting is a bit easier) once it was shown that the CI can now detect the issue.

Issues/PRs references

None.

@github-actions github-actions bot added the Area: tools Area: Supplementary tools label Dec 22, 2025
@maribu
Copy link
Copy Markdown
Member Author

maribu commented Dec 22, 2025

The test seems to work:

image
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:3:CFLAGS += -DFDB_USING_NATIVE_ASSERT
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:6:  CFLAGS += -DFDB_USING_TSDB
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:10:  CFLAGS += -DFDB_KV_AUTO_UPDATE
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:15:  CFLAGS += -DFDB_USING_KVDB
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:23:  CFLAGS += -DFDB_USING_FAL_MODE
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:28:    CFLAGS += -DFDB_USING_FILE_POSIX_MODE
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/flashdb/Makefile.dep:30:    CFLAGS += -DFDB_USING_FILE_LIBC_MODE
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/lwip/Makefile.dep:47:  CFLAGS += -DLWIP_SO_RCVTIMEO
  	
  	A Makefile.dep is for dependency modelling only. Modify CFLAGS in a Makefile.include, in an app's Makefile, or (if only relevant to a single module/package) in the module's/package's Makefile:
  		pkg/opendsme/Makefile.dep:38:CFLAGS += -DCONFIG_IEEE802154_AUTO_ACK_DISABLE=1

The dependency resolution phase MUST NOT change CFLAGS. Hence, any
modification of `CFLAGS` within a `Makefile.dep` is disallowed.

This moves the changes to the `Makefile.include` instead.
The `Makefile.dep` are intended for dependency tracking only. Modifying
CFLAGS as part of the dependency resolution process is just wrong.

This extends the build system sanity check to prevent this kind of
bug from sneaking in again.
@maribu maribu force-pushed the build-system/check-no-cflags-in-Makefile.dep branch from d835117 to 407b88f Compare December 22, 2025 09:56
@github-actions github-actions bot added Area: network Area: Networking Area: pkg Area: External package ports labels Dec 22, 2025
@maribu maribu added Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Area: CI Area: Continuous Integration of RIOT components and removed Area: network Area: Networking Area: pkg Area: External package ports labels Dec 22, 2025
@maribu maribu marked this pull request as ready for review December 22, 2025 09:56
@maribu maribu requested a review from miri64 as a code owner December 22, 2025 09:56
@riot-ci
Copy link
Copy Markdown

riot-ci commented Dec 22, 2025

Murdock results

✔️ PASSED

407b88f static-test: Check for Makefile.dep touching CFLAGS

Success Failures Total Runtime
10968 0 10968 12m:50s

Artifacts

@maribu maribu enabled auto-merge December 22, 2025 11:30
@maribu maribu added this pull request to the merge queue Dec 23, 2025
Merged via the queue into RIOT-OS:master with commit 59df477 Dec 23, 2025
31 checks passed
@maribu
Copy link
Copy Markdown
Member Author

maribu commented Dec 23, 2025

Thx ❤️

@maribu maribu deleted the build-system/check-no-cflags-in-Makefile.dep branch December 23, 2025 20:51
@leandrolanzieri leandrolanzieri added this to the Release 2026.01 milestone Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CI Area: Continuous Integration of RIOT components Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants