Created
April 8, 2025 16:09
-
-
Save Yousha/3bce677eed7c72d31302deb633253469 to your computer and use it in GitHub Desktop.
Fixes makefile error: *** missing separator. Stop.
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
#!/bin/bash | |
# File to fix. | |
MAKEFILE="Makefile" | |
# Check if the Makefile exists. | |
if [[ ! -f "$MAKEFILE" ]]; then | |
echo "Error: $MAKEFILE not found in the current directory." | |
exit 1 | |
fi | |
# Create a temporary file. | |
TEMP_FILE="Makefile.tmp" | |
# Process the Makefile, replacing space-indented lines with tabs. | |
awk '{ | |
# Replace lines that start with spaces and a command-like structure | |
if ($0 ~ /^[[:space:]]+[^[:space:]]/) | |
sub(/^[[:space:]]+/, "\t"); | |
}' "$MAKEFILE" > "$TEMP_FILE" | |
# Replace the original Makefile with the fixed one. | |
mv "$TEMP_FILE" "$MAKEFILE" | |
echo "Fixed $MAKEFILE: All lines with incorrect indentation have been replaced with tab-indented lines." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment