+# All object directories.
+OBJ_DIRS := $(DIRS)
+all_tree := $(patsubst %,$(top_builddir)/%,$(OBJ_DIRS) scripts scripts/config include)
+all_tree: $(all_tree)
+$(all_tree):
+ @mkdir -p "$@"
+
+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
+ $(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 (almost) all symbols in .config'
+ @echo ' allbareconfig - enable all basics without any features'
+ @echo ' config - text based configurator (of last resort)'
+ @echo ' defconfig - set .config to defaults'
+ @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 ' check - run the test suite for all applets'
+ @echo ' randconfig - generate a random configuration'
+ @echo ' release - create a distribution tarball'
+ @echo ' sizes - show size of all enabled busybox symbols'
+ @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