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>
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 @@
 
 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 @@
 		#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 @@
 		#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