Add header dependency tracking to the Makefile - #22
Open
pangin wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
The object pattern rule compiles without generating dependency files, so make only knows that each
.odepends on its.cpp. Editing a header rebuilds nothing that includes it.Symptom
After changing a class layout in a header (e.g. adding a member), an incremental build links stale objects compiled against the old layout together with fresh ones using the new layout. The result is silent memory corruption at runtime — we hit it as "stack smashing detected" and random segfaults while porting FastCarPlay to a Raspberry Pi Zero W (ARMv6) head unit, and it was very hard to trace back to the build system.
make clean"fixes" it, which is the tell.Fix
Compile with
-MMD -MPso the compiler emits a.dmakefile per object listing every header it includes, and-include $(OBJS:.o=.d)to feed those back into make. Touching a header now rebuilds exactly the objects that include it. First builds are unaffected; the.dfiles live in the existing per-build-type object tree and are removed byclean.🤖 Generated with Claude Code