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
11 src="$srctree/$d/Kbuild.src"
13 if test -f "$src"; then
16 s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
17 echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
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
24 test x"$REPLY" = x"INSERT" && REPLY="$s"
25 printf "%s\n" "$REPLY"
26 done <"$src" >>"$dst.$$.tmp"
28 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
32 mv -- "$dst.$$.tmp" "$dst"
36 src="$srctree/$d/Config.src"
38 if test -f "$src"; then
41 s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
42 echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
44 while IFS='' read -r REPLY; do
45 test x"$REPLY" = x"INSERT" && REPLY="$s"
46 printf "%s\n" "$REPLY"
47 done <"$src" >>"$dst.$$.tmp"
49 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
53 mv -- "$dst.$$.tmp" "$dst"
58 # Last read failed. This is normal. Don't exit with its error code: