summaryrefslogtreecommitdiff
path: root/scripts/gen_build_files.sh
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-25 13:30:59 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-25 13:30:59 +0200
commit1d72d439405fdf4b51eb9e22c5c7a469695ae29c (patch)
treef8416838c07f4e332f0d90952a81f4fd266abc5f /scripts/gen_build_files.sh
parente69c5e2429f78b695d2ee26bd0d3bbef17da4c07 (diff)
downloadbusybox-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-xscripts/gen_build_files.sh48
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"
11src="$srctree/include/applets.src.h" 11src="$srctree/include/applets.src.h"
12dst="include/applets.h" 12dst="include/applets.h"
13s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` 13s=`sed -n 's@^//applet:@@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
14echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" 14old=`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.
19new=`echo "/* DO NOT EDIT. This file is generated from applets.src.h */"
19while IFS='' read -r REPLY; do 20while 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"
22done <"$src" >>"$dst.$$.tmp" 23done <"$src"`
23if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then 24if test x"$new" != x"$old"; then
24 rm -- "$dst.$$.tmp"
25else
26 echo " GEN $dst" 25 echo " GEN $dst"
27 mv -- "$dst.$$.tmp" "$dst" 26 printf "%s\n" "$new" >"$dst"
28fi 27fi
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 ``)
37s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c` 36s=`sed -n -e 's@^//usage:\([ \t].*\)$@\1 \\\\@p' -e 's@^//usage:\([^ \t].*\)$@\n\1 \\\\@p' -- "$srctree"/*/*.c "$srctree"/*/*/*.c`
38echo "/* DO NOT EDIT. This file is generated from usage.src.h */" >"$dst.$$.tmp" 37old=`cat "$dst" 2>/dev/null`
39# Why "IFS='' read -r REPLY"?? 38new=`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.
43while IFS='' read -r REPLY; do 39while 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"
46done <"$src" >>"$dst.$$.tmp" 42done <"$src"`
47if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then 43if test x"$new" != x"$old"; then
48 rm -- "$dst.$$.tmp"
49else
50 echo " GEN $dst" 44 echo " GEN $dst"
51 mv -- "$dst.$$.tmp" "$dst" 45 printf "%s\n" "$new" >"$dst"
52fi 46fi
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
96done 88done