diff options
-rw-r--r-- | scripts/gen_build_files.sh | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 300d90c2a..3d757500c 100644 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh | |||
@@ -1,14 +1,13 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | test $# -ge 2 || exit 1 | 3 | test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } |
4 | 4 | ||
5 | # cd to objtree | 5 | # cd to objtree |
6 | cd "$2" || exit 1 | 6 | cd "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; } |
7 | 7 | ||
8 | srctree="$1" | 8 | srctree="$1" |
9 | 9 | ||
10 | find -type d \ | 10 | find -type d | while read; do |
11 | | while read; do | ||
12 | d="$REPLY" | 11 | d="$REPLY" |
13 | 12 | ||
14 | src="$srctree/$d/Kbuild.src" | 13 | src="$srctree/$d/Kbuild.src" |
@@ -16,11 +15,12 @@ find -type d \ | |||
16 | if test -f "$src"; then | 15 | if test -f "$src"; then |
17 | echo " CHK $dst" | 16 | echo " CHK $dst" |
18 | 17 | ||
19 | s=`grep -h '^//kbuild:' "$srctree/$d"/*.c | sed 's^//kbuild:^^'` | 18 | s=`sed -n 's@^//kbuild:@@p' "$srctree/$d"/*.c` |
19 | echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" | ||
20 | while read; do | 20 | while read; do |
21 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 21 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
22 | printf "%s\n" "$REPLY" | 22 | printf "%s\n" "$REPLY" |
23 | done <"$src" >"$dst.$$.tmp" | 23 | done <"$src" >>"$dst.$$.tmp" |
24 | 24 | ||
25 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 25 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then |
26 | rm "$dst.$$.tmp" | 26 | rm "$dst.$$.tmp" |
@@ -35,11 +35,12 @@ find -type d \ | |||
35 | if test -f "$src"; then | 35 | if test -f "$src"; then |
36 | echo " CHK $dst" | 36 | echo " CHK $dst" |
37 | 37 | ||
38 | s=`grep -h '^//config:' "$srctree/$d"/*.c | sed 's^//config:^^'` | 38 | s=`sed -n 's@^//config:@@p' "$srctree/$d"/*.c` |
39 | echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" | ||
39 | while read; do | 40 | while read; do |
40 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 41 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
41 | printf "%s\n" "$REPLY" | 42 | printf "%s\n" "$REPLY" |
42 | done <"$src" >"$dst.$$.tmp" | 43 | done <"$src" >>"$dst.$$.tmp" |
43 | 44 | ||
44 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 45 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then |
45 | rm "$dst.$$.tmp" | 46 | rm "$dst.$$.tmp" |