As an example, bunzip2 and bzcat is changed to use it.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
# To avoid any implicit rule to kick in, define an empty command.
scripts/basic/%: scripts_basic ;
+# This target generates Kbuild's and Config.in's from *.c files
+PHONY += gen_build_files
+gen_build_files:
+ $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree)
+
# bbox: we have helpers in applets/
# we depend on scripts_basic, since scripts/basic/fixdep
# must be built before any other host prog
PHONY += applets_dir
-applets_dir: scripts_basic
+applets_dir: scripts_basic gen_build_files
$(Q)$(MAKE) $(build)=applets
applets/%: applets_dir ;
$(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
endif
-# This target generates Kbuild's and Config.in's from *.c files
-PHONY += gen_build_files
-gen_build_files:
- $(Q)$(srctree)/scripts/gen_build_files.sh $(srctree) $(objtree)
-
# To make sure we do not include .config for any of the *config targets
# catch them early, and hand them over to scripts/kconfig/Makefile
# It is allowed to specify more targets when calling make, including
ifeq ($(KBUILD_EXTMOD),)
# Additional helpers built in scripts/
# Carefully list dependencies so we do not try to build scripts twice
-# in parrallel
+# in parallel
PHONY += scripts
scripts: gen_build_files scripts_basic include/config/MARKER
$(Q)$(MAKE) $(build)=$(@)
# Build system
# ==========================================================================
-busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h $(srctree)/include/applets.h
+busybox.links: $(srctree)/applets/busybox.mkll $(objtree)/include/autoconf.h include/applets.h
$(Q)-$(SHELL) $^ >$@
.PHONY: install
applets/applets.o: include/usage_compressed.h include/applet_tables.h
-applets/applet_tables: .config $(srctree_slash)include/applets.h
-applets/usage: .config $(srctree_slash)include/applets.h
-applets/usage_pod: .config include/applet_tables.h $(srctree_slash)include/applets.h
+applets/applet_tables: .config include/applets.h
+applets/usage: .config include/applets.h
+applets/usage_pod: .config include/applet_tables.h include/applets.h
quiet_cmd_gen_usage_compressed = GEN include/usage_compressed.h
cmd_gen_usage_compressed = $(srctree_slash)applets/usage_compressed include/usage_compressed.h applets
*
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
*/
+//applet:IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))
+//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP, bzcat))
#if ENABLE_BUNZIP2
static
IF_DESKTOP(long long) int FAST_FUNC unpack_bunzip2(unpack_info_t *info UNUSED_PARAM)
#endif
+INSERT
IF_TEST(APPLET_NOFORK([, test, _BB_DIR_USR_BIN, _BB_SUID_DROP, test))
IF_TEST(APPLET_NOFORK([[, test, _BB_DIR_USR_BIN, _BB_SUID_DROP, test))
IF_ACPID(APPLET(acpid, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_BLKID(APPLET(blkid, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_BOOTCHARTD(APPLET(bootchartd, _BB_DIR_SBIN, _BB_SUID_DROP))
IF_BRCTL(APPLET(brctl, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
-IF_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))
-IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP, bzcat))
IF_BZIP2(APPLET(bzip2, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_DROP))
IF_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_DROP, cat))
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
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"
#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
#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