3 # "read -r" without variable name reads line into $REPLY
4 # without stripping whitespace.
6 test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
9 cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
13 find -type d | while read -r d; do
14 src="$srctree/$d/Kbuild.src"
16 if test -f "$src"; then
19 s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
20 echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
22 test x"$REPLY" = x"INSERT" && REPLY="$s"
23 printf "%s\n" "$REPLY"
24 done <"$src" >>"$dst.$$.tmp"
26 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
30 mv -- "$dst.$$.tmp" "$dst"
34 src="$srctree/$d/Config.src"
36 if test -f "$src"; then
39 s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
40 echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
42 test x"$REPLY" = x"INSERT" && REPLY="$s"
43 printf "%s\n" "$REPLY"
44 done <"$src" >>"$dst.$$.tmp"
46 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
50 mv -- "$dst.$$.tmp" "$dst"
55 # Last read failed. This is normal. Don't exit with its error code: