diff options
Diffstat (limited to 'scripts/gen_build_files.sh')
-rwxr-xr-x | scripts/gen_build_files.sh | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/scripts/gen_build_files.sh b/scripts/gen_build_files.sh index b3aa132..44e8c17 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; } srctree="$1" +# (Re)generate include/applets.h +src="$srctree/include/applets.src.h" +dst="include/applets.h" +s=`sed -n 's@^//applet:@@p' -- */*.c */*/*.c` +echo "/* DO NOT EDIT. This file is generated from applets.src.h */" >"$dst.$$.tmp" +# Why "IFS='' read -r REPLY"?? +# This atrocity is needed to read lines without mangling. +# IFS='' prevents whitespace trimming, +# -r suppresses backslash handling. +while IFS='' read -r REPLY; do + test x"$REPLY" = x"INSERT" && REPLY="$s" + printf "%s\n" "$REPLY" +done <"$src" >>"$dst.$$.tmp" +if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then + rm -- "$dst.$$.tmp" +else + echo " GEN $dst" + mv -- "$dst.$$.tmp" "$dst" +fi + +# (Re)generate */Kbuild and */Config.in find -type d | while read -r d; do d="${d#./}" src="$srctree/$d/Kbuild.src" @@ -15,17 +36,12 @@ find -type d | while read -r d; do #echo " CHK $dst" s=`sed -n 's@^//kbuild:@@p' -- "$srctree/$d"/*.c` - echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" - # Why "IFS='' read -r REPLY"?? - # This atrocity is needed to read lines without mangling. - # IFS='' prevents whitespace trimming, - # -r suppresses backslash handling. + echo "# DO NOT EDIT. This file is generated from Kbuild.src" >"$dst.$$.tmp" while IFS='' read -r REPLY; do test x"$REPLY" = x"INSERT" && REPLY="$s" printf "%s\n" "$REPLY" done <"$src" >>"$dst.$$.tmp" - if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then rm -- "$dst.$$.tmp" else @@ -40,13 +56,12 @@ find -type d | while read -r d; do #echo " CHK $dst" s=`sed -n 's@^//config:@@p' -- "$srctree/$d"/*.c` - echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" + echo "# DO NOT EDIT. This file is generated from Config.src" >"$dst.$$.tmp" while IFS='' read -r REPLY; do test x"$REPLY" = x"INSERT" && REPLY="$s" printf "%s\n" "$REPLY" done <"$src" >>"$dst.$$.tmp" - if test -f "$dst" && cmp -s "$dst.$$.tmp" "$dst"; then rm -- "$dst.$$.tmp" else |