diff options
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/gen_build_files.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 6982877d8..d2db907f3 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh | |||
| @@ -1,7 +1,4 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | # bashism: | ||
| 3 | # "read -r" without variable name reads line into $REPLY | ||
| 4 | # without stripping whitespace. | ||
| 5 | 2 | ||
| 6 | test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } | 3 | test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } |
| 7 | 4 | ||
| @@ -18,7 +15,12 @@ find -type d | while read -r d; do | |||
| 18 | 15 | ||
| 19 | s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` | 16 | s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` |
| 20 | echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" | 17 | echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" |
| 21 | while read -r; do | 18 | |
| 19 | # Why "IFS='' read -r REPLY"?? | ||
| 20 | # This atrocity is needed to read lines without mangling. | ||
| 21 | # IFS='' prevents whitespace trimming, | ||
| 22 | # -r suppresses backslash handling. | ||
| 23 | while IFS='' read -r REPLY; do | ||
| 22 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 24 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
| 23 | printf "%s\n" "$REPLY" | 25 | printf "%s\n" "$REPLY" |
| 24 | done <"$src" >>"$dst.$$.tmp" | 26 | done <"$src" >>"$dst.$$.tmp" |
| @@ -38,7 +40,8 @@ find -type d | while read -r d; do | |||
| 38 | 40 | ||
| 39 | s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` | 41 | s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` |
| 40 | echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" | 42 | echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" |
| 41 | while read -r; do | 43 | |
| 44 | while IFS='' read -r REPLY; do | ||
| 42 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 45 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
| 43 | printf "%s\n" "$REPLY" | 46 | printf "%s\n" "$REPLY" |
| 44 | done <"$src" >>"$dst.$$.tmp" | 47 | done <"$src" >>"$dst.$$.tmp" |
