diff options
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 |