3 test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
6 cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
10 find -type d | while read -r d; do
12 src="$srctree/$d/Kbuild.src"
14 if test -f "$src"; then
17 s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
18 echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
20 # Why "IFS='' read -r REPLY"??
21 # This atrocity is needed to read lines without mangling.
22 # IFS='' prevents whitespace trimming,
23 # -r suppresses backslash handling.
24 while IFS='' read -r REPLY; do
25 test x"$REPLY" = x"INSERT" && REPLY="$s"
26 printf "%s\n" "$REPLY"
27 done <"$src" >>"$dst.$$.tmp"
29 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
33 mv -- "$dst.$$.tmp" "$dst"
37 src="$srctree/$d/Config.src"
39 if test -f "$src"; then
42 s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
43 echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
45 while IFS='' read -r REPLY; do
46 test x"$REPLY" = x"INSERT" && REPLY="$s"
47 printf "%s\n" "$REPLY"
48 done <"$src" >>"$dst.$$.tmp"
50 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
54 mv -- "$dst.$$.tmp" "$dst"
59 # Last read failed. This is normal. Don't exit with its error code: