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>
This commit is contained in:
parent
0e5ba0843b
commit
6c5bf0d347
14
Makefile
14
Makefile
@ -358,11 +358,16 @@ scripts_basic:
|
||||
# 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 ;
|
||||
@ -377,11 +382,6 @@ ifneq ($(KBUILD_SRC),)
|
||||
$(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
|
||||
@ -446,7 +446,7 @@ else
|
||||
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)=$(@)
|
||||
|
@ -2,7 +2,7 @@
|
||||
# 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
|
||||
|
@ -27,9 +27,9 @@ HOSTCFLAGS_usage_pod.o = -I$(srctree_slash)include -Iinclude
|
||||
|
||||
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
|
||||
|
@ -304,6 +304,8 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
|
||||
*
|
||||
* 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)
|
||||
|
@ -62,6 +62,7 @@ s - suid type:
|
||||
#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))
|
||||
@ -82,8 +83,6 @@ IF_BEEP(APPLET(beep, _BB_DIR_USR_BIN, _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))
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user