aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.IMA2
-rwxr-xr-xscripts/gen_build_files.sh31
2 files changed, 24 insertions, 9 deletions
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA
index a34db50f4..bddd70229 100644
--- a/scripts/Makefile.IMA
+++ b/scripts/Makefile.IMA
@@ -203,5 +203,5 @@ applets/applet_tables: include/autoconf.h
203include/usage_compressed.h: $(srctree)/include/usage.h applets/usage 203include/usage_compressed.h: $(srctree)/include/usage.h applets/usage
204 $(srctree)/applets/usage_compressed include/usage_compressed.h applets 204 $(srctree)/applets/usage_compressed include/usage_compressed.h applets
205 205
206include/applet_tables.h: $(srctree)/include/applets.h 206include/applet_tables.h: include/applets.h
207 applets/applet_tables include/applet_tables.h 207 applets/applet_tables include/applet_tables.h
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh
index b3aa132a3..44e8c1744 100755
--- a/scripts/gen_build_files.sh
+++ b/scripts/gen_build_files.sh
@@ -7,6 +7,27 @@ cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
7 7
8srctree="$1" 8srctree="$1"
9 9
10# (Re)generate include/applets.h
11src="$srctree/include/applets.src.h"
12dst="include/applets.h"
13s=`sed -n 's@^//applet:@@p' -- */*.c */*/*.c`
14echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp"
15# Why "IFS='' read -r REPLY"??
16# This atrocity is needed to read lines without mangling.
17# IFS='' prevents whitespace trimming,
18# -r suppresses backslash handling.
19while IFS='' read -r REPLY; do
20 test x"$REPLY" = x"INSERT" && REPLY="$s"
21 printf "%s\n" "$REPLY"
22done <"$src" >>"$dst.$$.tmp"
23if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
24 rm -- "$dst.$$.tmp"
25else
26 echo " GEN $dst"
27 mv -- "$dst.$$.tmp" "$dst"
28fi
29
30# (Re)generate */Kbuild and */Config.in
10find -type d | while read -r d; do 31find -type d | while read -r d; do
11 d="${d#./}" 32 d="${d#./}"
12 src="$srctree/$d/Kbuild.src" 33 src="$srctree/$d/Kbuild.src"
@@ -15,17 +36,12 @@ find -type d | while read -r d; do
15 #echo " CHK $dst" 36 #echo " CHK $dst"
16 37
17 s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` 38 s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c`
18 echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
19 39
20 # Why "IFS='' read -r REPLY"?? 40 echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp"
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 41 while IFS='' read -r REPLY; do
25 test x"$REPLY" = x"INSERT" && REPLY="$s" 42 test x"$REPLY" = x"INSERT" && REPLY="$s"
26 printf "%s\n" "$REPLY" 43 printf "%s\n" "$REPLY"
27 done <"$src" >>"$dst.$$.tmp" 44 done <"$src" >>"$dst.$$.tmp"
28
29 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then 45 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
30 rm -- "$dst.$$.tmp" 46 rm -- "$dst.$$.tmp"
31 else 47 else
@@ -40,13 +56,12 @@ find -type d | while read -r d; do
40 #echo " CHK $dst" 56 #echo " CHK $dst"
41 57
42 s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` 58 s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c`
43 echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
44 59
60 echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp"
45 while IFS='' read -r REPLY; do 61 while IFS='' read -r REPLY; do
46 test x"$REPLY" = x"INSERT" && REPLY="$s" 62 test x"$REPLY" = x"INSERT" && REPLY="$s"
47 printf "%s\n" "$REPLY" 63 printf "%s\n" "$REPLY"
48 done <"$src" >>"$dst.$$.tmp" 64 done <"$src" >>"$dst.$$.tmp"
49
50 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then 65 if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then
51 rm -- "$dst.$$.tmp" 66 rm -- "$dst.$$.tmp"
52 else 67 else