diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-25 13:30:59 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-06-25 13:30:59 +0200 |
commit | 1d72d439405fdf4b51eb9e22c5c7a469695ae29c (patch) | |
tree | f8416838c07f4e332f0d90952a81f4fd266abc5f /scripts/gen_build_files.sh | |
parent | e69c5e2429f78b695d2ee26bd0d3bbef17da4c07 (diff) | |
download | busybox-w32-1d72d439405fdf4b51eb9e22c5c7a469695ae29c.tar.gz busybox-w32-1d72d439405fdf4b51eb9e22c5c7a469695ae29c.tar.bz2 busybox-w32-1d72d439405fdf4b51eb9e22c5c7a469695ae29c.zip |
gen_build_files.sh is an order prerequisite only for autoconf.h
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'scripts/gen_build_files.sh')
-rwxr-xr-x | scripts/gen_build_files.sh | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index 647c7daf7..a98f509ce 100755 --- a/scripts/gen_build_files.sh +++ b/scripts/gen_build_files.sh | |||
@@ -11,20 +11,19 @@ srctree="$1" | |||
11 | src="$srctree/include/applets.src.h" | 11 | src="$srctree/include/applets.src.h" |
12 | dst="include/applets.h" | 12 | dst="include/applets.h" |
13 | s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` | 13 | s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` |
14 | echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" | 14 | old=`cat "$dst" 2>/dev/null` |
15 | # Why "IFS='' read -r REPLY"?? | 15 | # Why "IFS='' read -r REPLY"?? |
16 | # This atrocity is needed to read lines without mangling. | 16 | # This atrocity is needed to read lines without mangling. |
17 | # IFS='' prevents whitespace trimming, | 17 | # IFS='' prevents whitespace trimming, |
18 | # -r suppresses backslash handling. | 18 | # -r suppresses backslash handling. |
19 | new=`echo "/* DO NOT EDIT. This file is generated from applets.src.h */" | ||
19 | while IFS='' read -r REPLY; do | 20 | while IFS='' read -r REPLY; do |
20 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 21 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
21 | printf "%s\n" "$REPLY" | 22 | printf "%s\n" "$REPLY" |
22 | done <"$src" >>"$dst.$$.tmp" | 23 | done <"$src"` |
23 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 24 | if test x"$new" != x"$old"; then |
24 | rm -- "$dst.$$.tmp" | ||
25 | else | ||
26 | echo " GEN $dst" | 25 | echo " GEN $dst" |
27 | mv -- "$dst.$$.tmp" "$dst" | 26 | printf "%s\n" "$new" >"$dst" |
28 | fi | 27 | fi |
29 | 28 | ||
30 | # (Re)generate include/usage.h | 29 | # (Re)generate include/usage.h |
@@ -35,20 +34,15 @@ dst="include/usage.h" | |||
35 | # with space or tab | 34 | # with space or tab |
36 | # (note: we need to use \\\\ because of ``) | 35 | # (note: we need to use \\\\ because of ``) |
37 | s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` | 36 | s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` |
38 | echo "/* DO NOT EDIT. This file is generated from usage.src.h */" >"$dst.$$.tmp" | 37 | old=`cat "$dst" 2>/dev/null` |
39 | # Why "IFS='' read -r REPLY"?? | 38 | new=`echo "/* DO NOT EDIT. This file is generated from usage.src.h */" |
40 | # This atrocity is needed to read lines without mangling. | ||
41 | # IFS='' prevents whitespace trimming, | ||
42 | # -r suppresses backslash handling. | ||
43 | while IFS='' read -r REPLY; do | 39 | while IFS='' read -r REPLY; do |
44 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 40 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
45 | printf "%s\n" "$REPLY" | 41 | printf "%s\n" "$REPLY" |
46 | done <"$src" >>"$dst.$$.tmp" | 42 | done <"$src"` |
47 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 43 | if test x"$new" != x"$old"; then |
48 | rm -- "$dst.$$.tmp" | ||
49 | else | ||
50 | echo " GEN $dst" | 44 | echo " GEN $dst" |
51 | mv -- "$dst.$$.tmp" "$dst" | 45 | printf "%s\n" "$new" >"$dst" |
52 | fi | 46 | fi |
53 | 47 | ||
54 | # (Re)generate */Kbuild and */Config.in | 48 | # (Re)generate */Kbuild and */Config.in |
@@ -61,16 +55,15 @@ find -type d | while read -r d; do | |||
61 | 55 | ||
62 | s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` | 56 | s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` |
63 | 57 | ||
64 | echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" | 58 | old=`cat "$dst" 2>/dev/null` |
59 | new=`echo "# DO NOT EDIT. This file is generated from Kbuild.src" | ||
65 | while IFS='' read -r REPLY; do | 60 | while IFS='' read -r REPLY; do |
66 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 61 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
67 | printf "%s\n" "$REPLY" | 62 | printf "%s\n" "$REPLY" |
68 | done <"$src" >>"$dst.$$.tmp" | 63 | done <"$src"` |
69 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 64 | if test x"$new" != x"$old"; then |
70 | rm -- "$dst.$$.tmp" | ||
71 | else | ||
72 | echo " GEN $dst" | 65 | echo " GEN $dst" |
73 | mv -- "$dst.$$.tmp" "$dst" | 66 | printf "%s\n" "$new" >"$dst" |
74 | fi | 67 | fi |
75 | fi | 68 | fi |
76 | 69 | ||
@@ -81,16 +74,15 @@ find -type d | while read -r d; do | |||
81 | 74 | ||
82 | s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` | 75 | s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` |
83 | 76 | ||
84 | echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" | 77 | old=`cat "$dst" 2>/dev/null` |
78 | new=`echo "# DO NOT EDIT. This file is generated from Config.src" | ||
85 | while IFS='' read -r REPLY; do | 79 | while IFS='' read -r REPLY; do |
86 | test x"$REPLY" = x"INSERT" && REPLY="$s" | 80 | test x"$REPLY" = x"INSERT" && REPLY="$s" |
87 | printf "%s\n" "$REPLY" | 81 | printf "%s\n" "$REPLY" |
88 | done <"$src" >>"$dst.$$.tmp" | 82 | done <"$src"` |
89 | if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then | 83 | if test x"$new" != x"$old"; then |
90 | rm -- "$dst.$$.tmp" | ||
91 | else | ||
92 | echo " GEN $dst" | 84 | echo " GEN $dst" |
93 | mv -- "$dst.$$.tmp" "$dst" | 85 | printf "%s\n" "$new" >"$dst" |
94 | fi | 86 | fi |
95 | fi | 87 | fi |
96 | done | 88 | done |