+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)
+
+all: busybox busybox.links doc
+
+# In this section, we need .config
+-include $(top_builddir)/.config.cmd
+include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
+
+endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
+
+-include $(top_builddir)/.config
+-include $(top_builddir)/.depend
+
+
+ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
+libraries-y:=
+# Which parts of the internal libs are requested?
+# Per default we only want what was actually selected.
+# -a denotes all while -y denotes the selected ones.
+ifeq ($(strip $(CONFIG_FEATURE_FULL_LIBBUSYBOX)),y)
+LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a)
+LIBRARY_SRC :=$(LIBRARY_SRC-a)
+else # CONFIG_FEATURE_FULL_LIBBUSYBOX
+LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y)
+LIBRARY_SRC :=$(LIBRARY_SRC-y)
+endif # CONFIG_FEATURE_FULL_LIBBUSYBOX
+APPLET_SRC:=$(APPLET_SRC-y)
+APPLETS_DEFINE:=$(APPLETS_DEFINE-y)
+else # CONFIG_BUILD_AT_ONCE
+# no --combine, build archives out of the individual .o
+# This was the old way the binary was built.
+libbusybox-obj:=archival/libunarchive/libunarchive.a \
+ networking/libiproute/libiproute.a \
+ libpwdgrp/libpwdgrp.a \
+ coreutils/libcoreutils/libcoreutils.a \
+ libbb/libbb.a
+libbusybox-obj:=$(patsubst %,$(top_builddir)/%,$(libbusybox-obj))
+
+ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+# linking against libbusybox, so don't build the .a already contained in the .so
+libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
+endif # CONFIG_FEATURE_SHARED_BUSYBOX
+endif # CONFIG_BUILD_AT_ONCE
+
+
+ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
+LD_LIBBUSYBOX:=libbusybox.so
+LIBBUSYBOX_SONAME:=$(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL_VERSION)
+DO_INSTALL_LIBS:=$(LD_LIBBUSYBOX) \
+ $(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
+ $(LD_LIBBUSYBOX).$(MAJOR_VERSION).$(MINOR_VERSION)
+endif # CONFIG_BUILD_LIBBUSYBOX
+
+ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
+ifneq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+# --combine but not linking against libbusybox, so compile all
+BUSYBOX_SRC := $(LIBRARY_SRC)
+BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
+endif # !CONFIG_FEATURE_SHARED_BUSYBOX
+$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
+else # CONFIG_BUILD_AT_ONCE
+$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
+endif # CONFIG_BUILD_AT_ONCE
+
+ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+LDBUSYBOX:=-L$(top_builddir) -lbusybox
+endif