diff options
author | Denys Vlasenko | 2010-06-06 00:53:45 +0200 |
---|---|---|
committer | Denys Vlasenko | 2010-06-06 00:53:45 +0200 |
commit | 6c5bf0d347faded028e15d523c26a0d64c6d3920 (patch) | |
tree | 9dbe0229ec0d941c9efabb88571e6140d8e71951 /scripts | |
parent | 0e5ba0843b86a78d2d98a5fbaac8d33fe041f10e (diff) | |
download | busybox-6c5bf0d347faded028e15d523c26a0d64c6d3920.zip busybox-6c5bf0d347faded028e15d523c26a0d64c6d3920.tar.gz |
make it possible to have include/applets.h-esque entries in .c files
As an example, bunzip2 and bzcat is changed to use it.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.IMA | 2 | ||||
-rwxr-xr-x | scripts/gen_build_files.sh | 31 |
2 files changed, 24 insertions, 9 deletions
diff --git a/scripts/Makefile.IMA b/scripts/Makefile.IMA index a34db50..bddd702 100644 --- a/scripts/Makefile.IMA +++ b/scripts/Makefile.IMA @@ -203,5 +203,5 @@ applets/applet_tables: include/autoconf.h include/usage_compressed.h: $(srctree)/include/usage.h applets/usage $(srctree)/applets/usage_compressed include/usage_compressed.h applets -include/applet_tables.h: $(srctree)/include/applets.h +include/applet_tables.h: include/applets.h applets/applet_tables include/applet_tables.h 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 |