+ifneq ($(KBUILD_OUTPUT),)
+# Invoke a second make in the output directory, passing relevant variables
+# Check that the output directory actually exists
+saved-output := $(KBUILD_OUTPUT)
+KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+$(if $(wildcard $(KBUILD_OUTPUT)),, \
+ $(error output directory "$(saved-output)" does not exist))
+
+.PHONY: $(MAKECMDGOALS)
+
+$(filter-out _all,$(MAKECMDGOALS)) _all: $(KBUILD_OUTPUT)/Rules.mak $(KBUILD_OUTPUT)/Makefile all_tree
+ $(Q)$(MAKE) -C $(KBUILD_OUTPUT) \
+ top_srcdir=$(top_srcdir) \
+ top_builddir=$(top_builddir) \
+ KBUILD_SRC=$(top_srcdir) \
+ -f $(CURDIR)/Makefile $@
+
+$(KBUILD_OUTPUT)/Rules.mak:
+ @echo > $@
+ @echo top_srcdir=$(top_srcdir) >> $@
+ @echo top_builddir=$(KBUILD_OUTPUT) >> $@
+ @echo include $(top_srcdir)/Rules.mak >> $@
+
+$(KBUILD_OUTPUT)/Makefile:
+ @echo > $@
+ @echo top_srcdir=$(top_srcdir) >> $@
+ @echo top_builddir=$(KBUILD_OUTPUT) >> $@
+ @echo KBUILD_SRC='$$(top_srcdir)' >> $@
+ @echo include '$$(KBUILD_SRC)'/Makefile >> $@
+
+# Leave processing to above invocation of make
+skip-makefile := 1
+endif # ifneq ($(KBUILD_OUTPUT),)
+endif # ifeq ($(KBUILD_SRC),)
+
+ifeq ($(skip-makefile),)
+
+# We only need a copy of the Makefile for the config targets and reuse
+# the rest from the source directory, i.e. we do not cp ALL_MAKEFILES.
+scripts/config/Makefile: $(top_srcdir)/scripts/config/Makefile
+ cp $< $@
+
+_all: all
+
+help:
+ @echo 'Cleaning:'
+ @echo ' clean - delete temporary files created by build'
+ @echo ' distclean - delete all non-source files (including .config)'
+ @echo
+ @echo 'Build:'
+ @echo ' all - Executable and documentation'
+ @echo ' busybox - the swiss-army executable'
+ @echo ' doc - docs/BusyBox.{txt,html,1}'
+ @echo
+ @echo 'Configuration:'
+ @echo ' allnoconfig - disable all symbols in .config'
+ @echo ' allyesconfig - enable all symbols in .config (see defconfig)'
+ @echo ' allbareconfig - enable all applets without any sub-features'
+ @echo ' config - text based configurator (of last resort)'
+ @echo ' defconfig - set .config to largest generic configuration'
+ @echo ' menuconfig - interactive curses-based configurator'
+ @echo ' oldconfig - resolve any unresolved symbols in .config'
+ @echo
+ @echo 'Installation:'
+ @echo ' install - install busybox into $(PREFIX)'
+ @echo ' uninstall'
+ @echo
+ @echo 'Development:'
+ @echo ' bloatcheck - show size difference between busybox_unstripped'
+ @echo ' and busybox_old'
+ @echo ' check - run the test suite for all applets'
+ @echo ' checkhelp - check for missing help-entries in Config.in'
+ @echo ' randconfig - generate a random configuration'
+ @echo ' release - create a distribution tarball'
+ @echo ' sizes - show size of all enabled busybox symbols'
+ @echo ' objsizes - show size of each .o object built'
+ @echo
+
+
+include $(top_srcdir)/Rules.mak
+
+ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
+
+# Default target if none was requested explicitly
+all: menuconfig
+
+# warn if no configuration exists and we are asked to build a non-config target
+.config:
+ @echo ""
+ @echo "No $(top_builddir)/$@ found!"
+ @echo "Please refer to 'make help', section Configuration."
+ @echo ""
+ @exit 1
+
+# configuration
+# ---------------------------------------------------------------------------
+
+scripts/config/conf: scripts/config/Makefile
+ $(Q)$(MAKE) -C scripts/config conf
+ -@if [ ! -f .config ] ; then \
+ touch .config; \
+ fi
+
+scripts/config/mconf: scripts/config/Makefile
+ $(Q)$(MAKE) -C scripts/config ncurses conf mconf
+ -@if [ ! -f .config ] ; then \
+ touch .config; \
+ fi
+
+menuconfig: scripts/config/mconf
+ @[ -f .config ] || make $(MAKEFLAGS) defconfig
+ @./scripts/config/mconf $(CONFIG_CONFIG_IN)
+
+config: scripts/config/conf
+ @./scripts/config/conf $(CONFIG_CONFIG_IN)
+
+oldconfig: scripts/config/conf
+ @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
+
+randconfig: scripts/config/conf
+ @./scripts/config/conf -r $(CONFIG_CONFIG_IN)
+
+allyesconfig: scripts/config/conf
+ @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER)=.*/# \1 is not set/" .config
+ @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
+
+allnoconfig: scripts/config/conf
+ @./scripts/config/conf -n $(CONFIG_CONFIG_IN)
+
+# defconfig is allyesconfig minus any features that are specialized enough
+# or cause enough behavior change that the user really should switch them on
+# manually if that's what they want. Sort of "maximum sane config".
+
+defconfig: scripts/config/conf
+ @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG.*|STATIC|SELINUX|BUILD_(AT_ONCE|LIBBUSYBOX)|FEATURE_(DEVFS|FULL_LIBBUSYBOX|SHARED_BUSYBOX|MTAB_SUPPORT|CLEAN_UP|UDHCP_DEBUG)|INSTALL_NO_USR))=.*/# \1 is not set/" .config
+ @./scripts/config/conf -o $(CONFIG_CONFIG_IN)
+
+
+allbareconfig: scripts/config/conf
+ @./scripts/config/conf -y $(CONFIG_CONFIG_IN)
+ @$(SED) -i -r -e "s/^(USING_CROSS_COMPILER|CONFIG_(DEBUG|STATIC|SELINUX|DEVFSD|NC_GAPING_SECURITY_HOLE|BUILD_AT_ONCE)).*/# \1 is not set/" .config
+ @$(SED) -i -e "/FEATURE/s/=.*//;/^[^#]/s/.*FEATURE.*/# \0 is not set/;" .config
+ @echo "CONFIG_FEATURE_BUFFERS_GO_ON_STACK=y" >> .config
+ @yes n | ./scripts/config/conf -o $(CONFIG_CONFIG_IN)
+
+else # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)