diff options
| author | Amber Holly <halcyonsilver@gmail.com> | 2019-10-19 02:14:49 +0100 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-10-18 18:14:49 -0700 |
| commit | b23f6011c34dcb471c312655f7af37c0a0f5f779 (patch) | |
| tree | 4bacbf412e19469f4cda38d65f2943debed2f24a /util | |
| parent | 1b1e0977e020b3b381f874144aed31d0664d88d2 (diff) | |
| download | qmk_firmware-b23f6011c34dcb471c312655f7af37c0a0f5f779.tar.gz qmk_firmware-b23f6011c34dcb471c312655f7af37c0a0f5f779.zip | |
Remove build option firmware size impacts (#6947)
* Update rules.mk template to remove build option size impacts
* Add rules.mk cleaning script
* Update all rules.mk files to remove build option firmware size impact messages
* Remove references to feature filesize in documentation
* Revert "Update all rules.mk files to remove build option firmware size impact messages"
This reverts commit 7cfe70976bcc223bf47c960b2e6af8596df80a32.
* Fix regex in cleanup script and exclude keymaps/ directories
* Update quantum/template/avr/rules.mk
Fixed missing tabs/spaces.
Co-Authored-By: fauxpark <fauxpark@gmail.com>
Diffstat (limited to 'util')
| -rwxr-xr-x | util/rules_cleaner.sh | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/util/rules_cleaner.sh b/util/rules_cleaner.sh new file mode 100755 index 000000000..ac27c2b09 --- /dev/null +++ b/util/rules_cleaner.sh | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # This script finds all rules.mk files in keyboards/ subdirectories, | ||
| 4 | # and deletes the build option filesize impacts from them. | ||
| 5 | |||
| 6 | # Print an error message with the word "ERROR" in red. | ||
| 7 | echo_error() { | ||
| 8 | echo -e "[\033[0;91mERROR\033[m]: $1" | ||
| 9 | } | ||
| 10 | |||
| 11 | # If we've been started from util/, we want to be in qmk_firmware/ | ||
| 12 | [[ "$PWD" == *util ]] && cd .. | ||
| 13 | |||
| 14 | # The root qmk_firmware/ directory should have a subdirectory called quantum/ | ||
| 15 | if [ ! -d "quantum" ]; then | ||
| 16 | echo_error "Could not detect the QMK firmware directory!" | ||
| 17 | echo_error "Are you sure you're in the right place?" | ||
| 18 | exit 1 | ||
| 19 | fi | ||
| 20 | |||
| 21 | # Set the inplace editing parameter for sed. | ||
| 22 | # macOS/BSD sed expects a file extension immediately following -i. | ||
| 23 | set_sed_i() { | ||
| 24 | sed_i=(-i) | ||
| 25 | |||
| 26 | case $(uname -a) in | ||
| 27 | *Darwin*) sed_i=(-i "") | ||
| 28 | esac | ||
| 29 | } | ||
| 30 | set_sed_i | ||
| 31 | |||
| 32 | # Exclude keyamps/ directories | ||
| 33 | files=$(find keyboards -type f -name 'rules.mk' -not \( -path '*/keymaps*' -prune \)) | ||
| 34 | |||
| 35 | # Edit rules.mk files | ||
| 36 | for file in $files; do | ||
| 37 | sed "${sed_i[@]}" -e "s/(+[0-9].*)$//g" "$file" | ||
| 38 | done | ||
| 39 | |||
| 40 | echo "Cleaned up rules.mk files." | ||
