-
Notifications
You must be signed in to change notification settings - Fork 142
Improve Makefile bootstrap verification #304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Improve Makefile bootstrap verification #304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check https://cbea.ms/git-commit/ carefully and improve git commit message.
Don't mix independent changes into a single commit. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 1 file
f71718f
to
09464aa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Decouple the changes for fixing bootstrapping from those for consolidating the Makefile
. There should be at least two separate commits.
The bootstrap target was failing with '/bin/sh: @env: not found' because the original implementation used complex shell conditionals that could cause @ to be interpreted as a shell command. Changes: - Replace 'diff -q' with 'cmp -s' for reliable binary comparison - Restructure conditional to test for success rather than failure - Use plain echo for messages to avoid macro expansion issues - Add explicit success/error messages for clarity
09464aa
to
edd3db2
Compare
$(Q)if ! diff -q $(OUT)/$(STAGE1) $(OUT)/$(STAGE2); then \ | ||
echo "Unable to bootstrap. Aborting"; false; \ | ||
$(Q)if cmp -s $(OUT)/$(STAGE1) $(OUT)/$(STAGE2); then \ | ||
echo "Bootstrap successful: Stage 1 and Stage 2 are identical"; \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the true case, it is not necessary to display messages.
Changes
This PR improves the Makefile with better organization and more robust bootstrap verification while maintaining full self-hosting capabilities.
Key Improvements
Fixed bootstrap verification - Changed from
@if
to$(Q)if
and replaced$(VECHO)
with plainecho
inside shell conditionals to avoid/bin/sh: @env: not found
errorBetter organization
.PHONY
declarations.DEFAULT_GOAL
explicitEnhanced bootstrap process
cmp -s
instead ofdiff -q
for more reliable binary comparisonImproved directory handling
| $(OUT)
) to prevent unnecessary rebuildsmkdir -p
usage in compilation rulesAdded help target - Provides quick reference for available targets and variables
Consistency improvements
--silent
to--no-print-directory
for clearer intentCC ?= gcc
for easier compiler overridedeps
toDEPS
for naming consistencyTesting
What's Preserved
Summary by cubic
Strengthens Makefile bootstrap verification and fixes shell conditional errors to make the self-hosting build reliable. Also simplifies targets, flags, and directory handling for a cleaner build experience.
Bug Fixes
Refactors