Skip to content

Commit fddaf3d

Browse files
tlaurionfilipleple
authored andcommitted
Makefile: Auto-clean board build directories when coreboot canary changes
When the coreboot git commit changes (canary mismatch), remove and recreate the board-specific build directories to prevent stale artifacts from causing compilation failures. This eliminates the need for manual `rm -rf build/x86/BOARD` before rebuilding after coreboot canary updates in development cycles (when creating patches). One currently still has to, eg: echo "bogues repo url + commit hash" | sudo tee /home/user/heads/build/x86/coreboot-25.09/.canary Current logic then: 1. Detects canary changes and triggers repository cleanup 2. Removes both Heads board directory (build/x86/BOARD) and coreboot board directory (build/x86/coreboot-*/BOARD) that contain stale build artifacts 3. Recreates empty board directories for the subsequent build 4. Allows patches to apply cleanly without Ada compilation errors This ensures Ada builds work correctly after coreboot updates without manual intervention (resync repo, apply patches, clean artifact dirs and rebuilds only what changed). Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent ea9b4d8 commit fddaf3d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ define define_module =
492492
git -C "$(build)/$($1_base_dir)" submodule sync && \
493493
echo "INFO: Updating submodules (init and checkout)" && \
494494
git -C "$(build)/$($1_base_dir)" submodule update --init --checkout && \
495+
echo "INFO: Cleaning board-specific build directories to prevent stale artifacts" && \
496+
rm -rf "$(build)/$(BOARD)" "$(build)/$($1_base_dir)/$(BOARD)" && \
497+
echo "INFO: Recreating board directories" && \
498+
mkdir -p "$(build)/$(BOARD)" "$(build)/$($1_base_dir)/$(BOARD)" && \
495499
echo "INFO: Updating .canary file with new repo info" && \
496500
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@" ; \
497501
fi

0 commit comments

Comments
 (0)