aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-01-15 14:04:57 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-01-15 14:04:57 +0000
commit7ca61b6f3379bf66b446617b8834d92c13b366dd (patch)
treec0aaacfeb97a9bc74e73f8ff36ecbf1fd173808b
parent8c9daa12dcb4c1aa8f0f475896c9cfbcfb38370d (diff)
downloadbusybox-7ca61b6f3379bf66b446617b8834d92c13b366dd.tar.gz
- shared libbusybox.
- IMA compilation option (aka IPO, IPA,..) Please holler if i broke something..
-rw-r--r--Makefile128
-rw-r--r--Rules.mak36
-rw-r--r--applets/Makefile.in7
-rw-r--r--applets/applets.c2
-rw-r--r--applets/busybox.c2
-rwxr-xr-xapplets/install.sh19
-rw-r--r--archival/Makefile.in7
-rw-r--r--archival/libunarchive/Makefile.in34
-rw-r--r--console-tools/Makefile.in30
-rw-r--r--coreutils/Makefile.in5
-rw-r--r--coreutils/libcoreutils/Makefile.in55
-rw-r--r--debianutils/Makefile.in4
-rw-r--r--e2fsprogs/Makefile.in11
-rw-r--r--editors/Makefile.in9
-rw-r--r--findutils/Makefile.in5
-rw-r--r--include/libbb.h2
-rw-r--r--init/Makefile.in15
-rw-r--r--libbb/Makefile.in95
-rw-r--r--libbb/find_mount_point.c5
-rw-r--r--libpwdgrp/Makefile.in27
-rw-r--r--loginutils/Makefile.in7
-rw-r--r--miscutils/Makefile.in7
-rw-r--r--modutils/Makefile.in5
-rw-r--r--networking/Makefile.in12
-rw-r--r--networking/libiproute/Makefile.in45
-rw-r--r--networking/udhcp/Makefile.in30
-rw-r--r--procps/Makefile.in5
-rw-r--r--shell/Makefile.in5
-rw-r--r--sysdeps/linux/Config.in60
-rw-r--r--sysklogd/Makefile.in5
-rw-r--r--util-linux/Makefile.in6
31 files changed, 514 insertions, 171 deletions
diff --git a/Makefile b/Makefile
index d3630c2ed..0a2a816de 100644
--- a/Makefile
+++ b/Makefile
@@ -185,6 +185,7 @@ randconfig: scripts/config/conf
allyesconfig: scripts/config/conf
@./scripts/config/conf -y $(CONFIG_CONFIG_IN)
sed -i -r -e "s/^(CONFIG_DEBUG|USING_CROSS_COMPILER|CONFIG_STATIC|CONFIG_SELINUX|CONFIG_FEATURE_DEVFS).*/# \1 is not set/" .config
+ echo "CONFIG_FEATURE_SHARED_BUSYBOX=y" >> .config
@./scripts/config/conf -o $(CONFIG_CONFIG_IN)
allnoconfig: scripts/config/conf
@@ -207,19 +208,102 @@ all: busybox busybox.links doc
# In this section, we need .config
-include $(top_builddir)/.config.cmd
include $(patsubst %,%/Makefile.in, $(SRC_DIRS))
--include $(top_builddir)/.depend
endif # ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
-busybox: .depend $(libraries-y)
- $(CC) $(EXTRA_CFLAGS) $(LDFLAGS) -o $@ -Wl,--start-group $(libraries-y) $(LIBRARIES) -Wl,--end-group
+-include $(top_builddir)/.config
+-include $(top_builddir)/.depend
+
+
+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)
+
+ifeq ($(CONFIG_BUILD_AT_ONCE),y)
+# Which parts of the internal libs are requested?
+# Per default we only want what was actually selected.
+ifeq ($(CONFIG_FEATURE_FULL_LIBBUSYBOX),y)
+LIBRARY_DEFINE:=$(LIBRARY_DEFINE-a)
+LIBRARY_SRC :=$(LIBRARY_SRC-a)
+$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
+else
+LIBRARY_DEFINE:=$(LIBRARY_DEFINE-y)
+LIBRARY_SRC :=$(LIBRARY_SRC-y)
+$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
+endif
+else # CONFIG_BUILD_AT_ONCE
+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))
+
+$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
+
+LIBRARY_DEFINE:=
+LIBRARY_SRC :=
+endif # CONFIG_BUILD_AT_ONCE
+
+
+$(LIBBUSYBOX_SONAME):
+ifndef MAJOR_VERSION
+ $(error MAJOR_VERSION needed for $@ is not defined)
+endif
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(LDFLAGS) -shared \
+ $(CFLAGS_PIC) \
+ -Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
+ -Wl,--enable-new-dtags -Wl,--reduce-memory-overheads \
+ -Wl,-z,combreloc -Wl,-shared -Wl,--as-needed -Wl,--warn-shared-textrel \
+ -o $(@) \
+ -Wl,--start-group -Wl,--whole-archive \
+ $(LIBRARY_DEFINE) $(^) \
+ -Wl,--no-whole-archive -Wl,--end-group
+ $(RM_F) $(DO_INSTALL_LIBS)
+ for i in $(DO_INSTALL_LIBS); do $(LN_S) -v $(@) $$i ; done
+ $(STRIPCMD) $@
+
+endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
+
+
+ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+libraries-y:=$(filter-out $(libbusybox-obj),$(libraries-y))
+LDBUSYBOX:=-L$(top_builddir) -lbusybox
+BUSYBOX_SRC :=
+BUSYBOX_DEFINE:=
+else
+#LDBUSYBOX:=
+BUSYBOX_SRC := $(LIBRARY_SRC)
+BUSYBOX_DEFINE:= $(LIBRARY_DEFINE)
+endif # ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+
+
+ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
+libraries-y:=
+else
+BUSYBOX_SRC:=
+BUSYBOX_DEFINE:=
+APPLET_SRC-y:=
+APPLETS_DEFINE-y:=
+endif
+
+busybox: .depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(libraries-y)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(PROG_CFLAGS) $(LDFLAGS) \
+ -o $@ -Wl,--start-group \
+ $(APPLETS_DEFINE-y) $(APPLET_SRC-y) $(BUSYBOX_DEFINE) $(BUSYBOX_SRC) $(libraries-y) $(LDBUSYBOX) $(LIBRARIES) \
+ -Wl,--end-group
$(STRIPCMD) $@
busybox.links: $(top_srcdir)/applets/busybox.mkll include/bb_config.h $(top_srcdir)/include/applets.h
- $(SHELL) $^ >$@
install: $(top_srcdir)/applets/install.sh busybox busybox.links
- $(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
+ DO_INSTALL_LIBS="$(strip $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS))" \
+ $(SHELL) $< $(PREFIX) $(INSTALL_OPTS)
ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
@echo
@echo
@@ -232,8 +316,13 @@ ifeq ($(strip $(CONFIG_FEATURE_SUID)),y)
endif
uninstall: busybox.links
- rm -f $(PREFIX)/bin/busybox
- for i in `cat busybox.links` ; do rm -f $(PREFIX)$$i; done
+ $(RM_F) $(PREFIX)/bin/busybox
+ for i in `cat busybox.links` ; do $(RM_F) $(PREFIX)$$i; done
+ifneq ($(strip $(DO_INSTALL_LIBS)),n)
+ for i in $(LIBBUSYBOX_SONAME) $(DO_INSTALL_LIBS); do \
+ $(RM_F) $(PREFIX)$$i; \
+ done
+endif
# see if we are in verbose mode
KBUILD_VERBOSE :=
@@ -244,13 +333,14 @@ ifdef V
endif
ifneq ($(strip $(KBUILD_VERBOSE)),)
CHECK_VERBOSE := -v
+# ARFLAGS+=v
endif
check test: busybox
bindir=$(top_builddir) srcdir=$(top_srcdir)/testsuite \
$(top_srcdir)/testsuite/runtest $(CHECK_VERBOSE)
sizes:
- -rm -f busybox
+ -$(RM_F) busybox
$(MAKE) top_srcdir=$(top_srcdir) top_builddir=$(top_builddir) \
-f $(top_srcdir)/Makefile STRIPCMD=/bin/true
$(NM) --size-sort busybox
@@ -278,14 +368,14 @@ docs/BusyBox.1: docs/busybox.pod
docs/BusyBox.html: docs/busybox.net/BusyBox.html
- mkdir -p docs
- -@ rm -f docs/BusyBox.html
+ -@ $(RM_F) docs/BusyBox.html
-@ cp docs/busybox.net/BusyBox.html docs/BusyBox.html
docs/busybox.net/BusyBox.html: docs/busybox.pod
-@ mkdir -p docs/busybox.net
- pod2html --noindex $< > \
docs/busybox.net/BusyBox.html
- -@ rm -f pod2htm*
+ -@ $(RM_F) pod2htm*
# The nifty new buildsystem stuff
scripts/bb_mkdep: $(top_srcdir)/scripts/bb_mkdep.c
@@ -302,7 +392,7 @@ endif
depend dep: .depend
.depend: scripts/bb_mkdep $(DEP_INCLUDES)
- @rm -f .depend
+ @$(RM_F) .depend
@mkdir -p include/config
scripts/bb_mkdep -c include/config.h -c include/bb_config.h \
-I $(top_srcdir)/include $(top_srcdir) > $@.tmp
@@ -323,22 +413,24 @@ include/bb_config.h: include/config.h
clean:
- $(MAKE) -C scripts/config $@
- - rm -f docs/busybox.dvi docs/busybox.ps \
+ - $(RM_F) docs/busybox.dvi docs/busybox.ps \
docs/busybox.pod docs/busybox.net/busybox.html \
docs/busybox pod2htm* *.gdb *.elf *~ core .*config.log \
docs/BusyBox.txt docs/BusyBox.1 docs/BusyBox.html \
docs/busybox.net/BusyBox.html busybox.links libbb/loop.h \
+ $(DO_INSTALL_LIBS) $(LIBBUSYBOX_SONAME) \
.config.old busybox
- rm -rf _install testsuite/links
- - find . -name .\*.flags -exec rm -f {} \;
- - find . -name \*.o -exec rm -f {} \;
- - find . -name \*.a -exec rm -f {} \;
+ - find . -name .\*.flags -exec $(RM_F) {} \;
+ - find . -name \*.o -exec $(RM_F) {} \;
+ - find . -name \*.a -exec $(RM_F) {} \;
+ - find . -name \*.so -exec $(RM_F) {} \;
distclean: clean
- - rm -f scripts/bb_mkdep
+ - $(RM_F) scripts/bb_mkdep
- rm -rf include/config include/config.h include/bb_config.h include/bbconfigopts.h
- - find . -name .depend -exec rm -f {} \;
- rm -f .config .config.old .config.cmd
+ - find . -name .depend -exec $(RM_F) {} \;
+ $(RM_F) .config .config.old .config.cmd
release: distclean #doc
cd ..; \
@@ -353,7 +445,7 @@ release: distclean #doc
find $(PROG)-$(VERSION)/ -type f \
-name .\#* \
-print \
- -exec rm -f {} \; ; \
+ -exec $(RM_F) {} \; ; \
\
tar -cvzf $(PROG)-$(VERSION).tar.gz $(PROG)-$(VERSION)/;
diff --git a/Rules.mak b/Rules.mak
index b142ee41f..df3c22e7d 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -81,7 +81,8 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
#GCCINCDIR:=$(shell gcc -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp")
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
-CFLAGS=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
+CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include -I$(srcdir)
+
ARFLAGS=cru
@@ -125,6 +126,8 @@ endif
CFLAGS+=$(call check_gcc,-funsigned-char,)
+CFLAGS+=$(call check_gcc,-mmax-stack-frame=256,)
+
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
# Unless you want to override the defaults, do not set anything
@@ -133,15 +136,38 @@ CFLAGS+=$(call check_gcc,-funsigned-char,)
# use '-Os' optimization if available, else use -O2
OPTIMIZATION:=$(call check_gcc,-Os,-O2)
+ifeq ($(CONFIG_BUILD_AT_ONCE),y)
+# gcc 2.95 exits with 0 for "unrecognized option"
+ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 3 ] ; echo $$?)),0)
+ OPTIMIZATION+=$(call check_gcc,-combine,)
+endif
+OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
+PROG_CFLAGS+=$(call check_gcc,-fwhole-program,)
+endif # CONFIG_BUILD_AT_ONCE
+
# Some nice architecture specific optimizations
ifeq ($(strip $(TARGET_ARCH)),arm)
OPTIMIZATION+=-fstrict-aliasing
+ OPTIMIZATION+=$(call check_gcc,-msingle-pic-base,)
endif
ifeq ($(strip $(TARGET_ARCH)),i386)
OPTIMIZATION+=$(call check_gcc,-march=i386,)
+# gcc-4.0 and older seem to suffer from these
+ifneq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
OPTIMIZATION+=$(call check_gcc,-mpreferred-stack-boundary=2,)
OPTIMIZATION+=$(call check_gcc,-falign-functions=0 -falign-jumps=0 -falign-loops=0,\
-malign-functions=0 -malign-jumps=0 -malign-loops=0)
+endif # gcc-4.0 and older
+
+# gcc-4.1 and beyond seem to benefit from these
+ifeq ($(strip $(shell [ $(CC_MAJOR) -ge 4 -a $(CC_MINOR) -ge 1 ] ; echo $$?)),0)
+ # turn off flags which hurt -Os
+ OPTIMIZATION+=$(call check_gcc,-fno-tree-loop-optimize,)
+ OPTIMIZATION+=$(call check_gcc,-fno-tree-dominator-opts,)
+ OPTIMIZATION+=$(call check_gcc,-fno-strength-reduce,)
+
+ OPTIMIZATION+=$(call check_gcc,-fno-branch-count-reg,)
+endif # gcc-4.1 and beyond
endif
OPTIMIZATIONS:=$(OPTIMIZATION) -fomit-frame-pointer
@@ -173,11 +199,17 @@ ifeq ($(strip $(CONFIG_DEBUG)),y)
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
- LDFLAGS += -Wl,-warn-common
+ LDFLAGS += -Wl,-warn-common -Wl,--sort-common
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
ifeq ($(strip $(CONFIG_STATIC)),y)
LDFLAGS += --static
+#else
+# LIBRARIES += -ldl
+endif
+
+ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
+ CFLAGS_PIC:= -fPIC #-DPIC
endif
ifeq ($(strip $(CONFIG_SELINUX)),y)
diff --git a/applets/Makefile.in b/applets/Makefile.in
index 511652a93..80b6da0b1 100644
--- a/applets/Makefile.in
+++ b/applets/Makefile.in
@@ -10,8 +10,11 @@ APPLETS_DIR:=$(top_builddir)/applets/
endif
srcdir=$(top_srcdir)/applets
-APPLET_SRC:=applets.c busybox.c
-APPLET_OBJ:= $(patsubst %.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
+APPLET_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c)
+APPLET_OBJ:= $(patsubst $(srcdir)/%.c,$(APPLETS_DIR)%.o, $(APPLET_SRC))
+
+APPLET_SRC-y+=$(APPLET_SRC)
+APPLET_SRC-a+=$(APPLET_SRC)
libraries-y+=$(APPLETS_DIR)$(APPLETS_AR)
diff --git a/applets/applets.c b/applets/applets.c
index dde75f236..de1a871e0 100644
--- a/applets/applets.c
+++ b/applets/applets.c
@@ -265,7 +265,7 @@ static void parse_config_file(void)
}
/* Now get the the user/group info. */
-
+
s = (char *) bb_skip_whitespace(e);
/* Note: We require whitespace between the mode and the
diff --git a/applets/busybox.c b/applets/busybox.c
index 90ea2bdce..3d7a0fd0b 100644
--- a/applets/busybox.c
+++ b/applets/busybox.c
@@ -11,7 +11,7 @@
#define setlocale(x,y)
#endif
-const char *bb_applet_name;
+const char *bb_applet_name __attribute__((externally_visible));
#ifdef CONFIG_FEATURE_INSTALLER
/*
diff --git a/applets/install.sh b/applets/install.sh
index 2fcd2ae6e..cc6c1fa49 100755
--- a/applets/install.sh
+++ b/applets/install.sh
@@ -3,8 +3,8 @@
export LC_ALL=POSIX
export LC_CTYPE=POSIX
-prefix=$1
-if [ "$prefix" = "" ]; then
+prefix=${1}
+if [ -z "$prefix" ]; then
echo "No installation directory, aborting."
exit 1;
fi
@@ -16,7 +16,22 @@ case "$2" in
*) echo "Unknown install option: $2"; exit 1;;
esac
+if [ "$DO_INSTALL_LIBS" != "n" ]; then
+ # get the target dir for the libs
+ # This is an incomplete/incorrect list for now
+ case $(uname -m) in
+ x86_64|ppc64*|sparc64*|ia64*|hppa*64*) libdir=/lib64 ;;
+ *) libdir=/lib ;;
+ esac
+ mkdir -p $prefix/$libdir || exit 1
+ for i in $DO_INSTALL_LIBS; do
+ rm -f $prefix/$libdir/$i || exit 1
+ if [ -f $i ]; then
+ install -m 644 $i $prefix/$libdir/ || exit 1
+ fi
+ done
+fi
rm -f $prefix/bin/busybox || exit 1
mkdir -p $prefix/bin || exit 1
install -m 755 busybox $prefix/bin/busybox || exit 1
diff --git a/archival/Makefile.in b/archival/Makefile.in
index f4ec6794e..735b659e0 100644
--- a/archival/Makefile.in
+++ b/archival/Makefile.in
@@ -27,8 +27,13 @@ ARCHIVAL-$(CONFIG_UNZIP) += unzip.o
libraries-y+=$(ARCHIVAL_DIR)$(ARCHIVAL_AR)
+ARCHIVAL_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(ARCHIVAL-y))
+ARCHIVAL_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(ARCHIVAL_SRC-y)
+APPLET_SRC-a+=$(ARCHIVAL_SRC-a)
+
$(ARCHIVAL_DIR)$(ARCHIVAL_AR): $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
- $(AR) $(ARFLAGS) $@ $(patsubst %,$(ARCHIVAL_DIR)%, $(ARCHIVAL-y))
+ $(AR) $(ARFLAGS) $@ $(^)
$(ARCHIVAL_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in
index 98fd76c12..99eb6386d 100644
--- a/archival/libunarchive/Makefile.in
+++ b/archival/libunarchive/Makefile.in
@@ -2,27 +2,20 @@
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
#
LIBUNARCHIVE_AR:=libunarchive.a
ifndef $(LIBUNARCHIVE_DIR)
-LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive/
+LIBUNARCHIVE_DIR:=$(top_builddir)/archival/libunarchive
endif
srcdir=$(top_srcdir)/archival/libunarchive
+LIBUNARCHIVE-obj:=$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR)
+LIBUNARCHIVE-pic:=$(LIBUNARCHIVE_DIR)/$(subst .a,-pic.a,$(LIBUNARCHIVE_AR))
+
+libraries-y+=$(LIBUNARCHIVE-obj)
+
LIBUNARCHIVE-y:= \
\
data_skip.o \
@@ -74,12 +67,17 @@ LIBUNARCHIVE-$(CONFIG_FEATURE_TAR_COMPRESS) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNCOMPRESS) += decompress_uncompress.o
LIBUNARCHIVE-$(CONFIG_UNZIP) += $(GUNZIP_FILES)
-libraries-y+=$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR)
LIBUNARCHIVE-y:=$(sort $(LIBUNARCHIVE-y))
-$(LIBUNARCHIVE_DIR)$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
- $(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBUNARCHIVE_DIR)%, $(LIBUNARCHIVE-y))
-$(LIBUNARCHIVE_DIR)%.o: $(srcdir)/%.c
+LIBUNARCHIVE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBUNARCHIVE-y)))
+LIBUNARCHIVE_SRC-a:=$(wildcard $(srcdir)/*.c)
+LIBRARY_SRC-y+=$(LIBUNARCHIVE_SRC-y)
+LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a)
+
+$(LIBUNARCHIVE_DIR)/$(LIBUNARCHIVE_AR): $(patsubst %,$(LIBUNARCHIVE_DIR)/%,$(LIBUNARCHIVE-y))
+ $(AR) $(ARFLAGS) $(@) $(^)
+
+$(LIBUNARCHIVE_DIR)/%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
diff --git a/console-tools/Makefile.in b/console-tools/Makefile.in
index 46cf524be..87858cd8e 100644
--- a/console-tools/Makefile.in
+++ b/console-tools/Makefile.in
@@ -10,22 +10,26 @@ CONSOLETOOLS_DIR:=$(top_builddir)/console-tools/
endif
srcdir=$(top_srcdir)/console-tools
-CONSOLETOOLS_DIR-y:=
-CONSOLETOOLS_DIR-$(CONFIG_CHVT) += chvt.o
-CONSOLETOOLS_DIR-$(CONFIG_CLEAR) += clear.o
-CONSOLETOOLS_DIR-$(CONFIG_DEALLOCVT) += deallocvt.o
-CONSOLETOOLS_DIR-$(CONFIG_DUMPKMAP) += dumpkmap.o
-CONSOLETOOLS_DIR-$(CONFIG_SETCONSOLE) += setconsole.o
-CONSOLETOOLS_DIR-$(CONFIG_LOADFONT) += loadfont.o
-CONSOLETOOLS_DIR-$(CONFIG_LOADKMAP) += loadkmap.o
-CONSOLETOOLS_DIR-$(CONFIG_OPENVT) += openvt.o
-CONSOLETOOLS_DIR-$(CONFIG_RESET) += reset.o
-CONSOLETOOLS_DIR-$(CONFIG_SETKEYCODES) += setkeycodes.o
+CONSOLETOOLS-y:=
+CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o
+CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
+CONSOLETOOLS-$(CONFIG_DEALLOCVT) += deallocvt.o
+CONSOLETOOLS-$(CONFIG_DUMPKMAP) += dumpkmap.o
+CONSOLETOOLS-$(CONFIG_SETCONSOLE) += setconsole.o
+CONSOLETOOLS-$(CONFIG_LOADFONT) += loadfont.o
+CONSOLETOOLS-$(CONFIG_LOADKMAP) += loadkmap.o
+CONSOLETOOLS-$(CONFIG_OPENVT) += openvt.o
+CONSOLETOOLS-$(CONFIG_RESET) += reset.o
+CONSOLETOOLS-$(CONFIG_SETKEYCODES) += setkeycodes.o
libraries-y+=$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR)
+CONSOLETOOLS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(CONSOLETOOLS-y))
+CONSOLETOOLS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(CONSOLETOOLS_SRC-y)
+APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a)
-$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
- $(AR) $(ARFLAGS) $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS_DIR-y))
+$(CONSOLETOOLS_DIR)$(CONSOLETOOLS_AR): $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y))
+ $(AR) $(ARFLAGS) $@ $(patsubst %,$(CONSOLETOOLS_DIR)%, $(CONSOLETOOLS-y))
$(CONSOLETOOLS_DIR)%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in
index 9dc604b1a..54ccf921f 100644
--- a/coreutils/Makefile.in
+++ b/coreutils/Makefile.in
@@ -81,7 +81,12 @@ COREUTILS-$(CONFIG_WHO) += who.o
COREUTILS-$(CONFIG_WHOAMI) += whoami.o
COREUTILS-$(CONFIG_YES) += yes.o
+COREUTILS-y:=$(sort $(COREUTILS-y))
libraries-y+=$(COREUTILS_DIR)$(COREUTILS_AR)
+COREUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(COREUTILS-y))
+COREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(COREUTILS_SRC-y)
+APPLET_SRC-a+=$(COREUTILS_SRC-a)
$(COREUTILS_DIR)$(COREUTILS_AR): $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(COREUTILS_DIR)%, $(COREUTILS-y))
diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in
index fe66c8243..1f0c19e73 100644
--- a/coreutils/libcoreutils/Makefile.in
+++ b/coreutils/libcoreutils/Makefile.in
@@ -2,36 +2,51 @@
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
#
LIBCOREUTILS_AR:=libcoreutils.a
ifndef $(LIBCOREUTILS_DIR)
-LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils/
+LIBCOREUTILS_DIR:=$(top_builddir)/coreutils/libcoreutils
endif
srcdir=$(top_srcdir)/coreutils/libcoreutils
-LIBCOREUTILS_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c
+LIBCOREUTILS_ALL_SRC:= cp_mv_stat.c getopt_mk_fifo_nod.c
+
+LIBCOREUTILS-y:=
+LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod.o
+LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod.o
+LIBCOREUTILS-$(CONFIG_INSTALL) += cp_mv_stat.o
+LIBCOREUTILS-$(CONFIG_CP) += cp_mv_stat.o
+LIBCOREUTILS-$(CONFIG_MV) += cp_mv_stat.o
+
+LIBCOREUTILS-y:=$(sort $(LIBCOREUTILS-y))
+
+LIBCOREUTILS_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBCOREUTILS-y)))
+LIBCOREUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y)
+LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a)
-LIBCOREUTILS_OBJS=$(patsubst %.c,$(LIBCOREUTILS_DIR)%.o, $(LIBCOREUTILS_SRC))
+LIBCOREUTILS-multi-obj:=$(LIBCOREUTILS_DIR)/$(subst .a,-multi.o,$(LIBCOREUTILS_AR))
+LIBCOREUTILS-multi-pic:=$(LIBCOREUTILS_DIR)/$(subst .a,-pic.o,$(LIBCOREUTILS_AR))
+
+# We do not need to build an empty non-pic object/archive
+ifneq ($(strip $(LIBCOREUTILS-y)),)
+libraries-y+=$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR)
+endif
+# If we are building libbusybox.so _and_ we will use it ourselves then we
+# keep it as small as possible
+ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+ifneq ($(strip $(LIBIPROUTE-y)),)
+libraries-m+=$(LIBCOREUTILS-multi-pic)
+endif
+endif
-libraries-y+=$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR)
+LIBCOREUTILS_OBJS=$(patsubst %,$(LIBCOREUTILS_DIR)/%, $(LIBCOREUTILS-y))
-$(LIBCOREUTILS_DIR)$(LIBCOREUTILS_AR): $(LIBCOREUTILS_OBJS)
- $(AR) $(ARFLAGS) $@ $(LIBCOREUTILS_OBJS)
+$(LIBCOREUTILS_DIR)/$(LIBCOREUTILS_AR): $(patsubst %,$(LIBCOREUTILS_DIR)/%,$(LIBCOREUTILS-y))
+ $(AR) $(ARFLAGS) $(@) $(^)
-$(LIBCOREUTILS_DIR)%.o: $(srcdir)/%.c
+$(LIBCOREUTILS_DIR)/%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in
index c0185f4aa..4a715d0d8 100644
--- a/debianutils/Makefile.in
+++ b/debianutils/Makefile.in
@@ -19,6 +19,10 @@ DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o
DEBIANUTILS-$(CONFIG_WHICH) += which.o
libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR)
+DEBIANUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(DEBIANUTILS-y))
+DEBIANUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(DEBIANUTILS_SRC-y)
+APPLET_SRC-a+=$(DEBIANUTILS_SRC-a)
$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR): $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(DEBIANUTILS_DIR)%, $(DEBIANUTILS-y))
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in
index 181ec7033..c492c6779 100644
--- a/e2fsprogs/Makefile.in
+++ b/e2fsprogs/Makefile.in
@@ -62,8 +62,19 @@ E2FSPROGS-$(CONFIG_LSATTR) += lsattr.o $(E2P_OBJS)
E2FSPROGS-$(CONFIG_MKE2FS) += mke2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
E2FSPROGS-$(CONFIG_TUNE2FS) += tune2fs.o util.o $(E2P_OBJS) $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
+E2FSPROGS-y:=$(sort $(E2FSPROGS-y))
+
libraries-y+=$(E2FSPROGS_DIR)/$(E2FSPROGS_AR)
+E2FSPROGS_SRC-y:=$(patsubst %.o,$(E2FSPROGS_SRC)/%.c,$(E2FSPROGS-y))
+E2FSPROGS_SRC-a:=$(wildcard $(E2FSPROGS_SRC)/*.c) $(patsubst %,$(E2FSPROGS_SRC)/%,$(BLKID_SRCS) $(E2P_SRCS) $(EXT2FS_SRCS) $(UUID_SRCS))
+APPLET_SRC-y+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-y)
+APPLET_SRC-a+=$(E2FSPROGS_CFLAGS) $(E2FSPROGS_SRC-a)
+
+# XXX: FIXME: change .c to include their stuff relative to $(E2FSPROGS_SRC)
+E2FSPROGS_TMP_KLUDGE:=$(patsubst %,-I$(E2FSPROGS_SRC)/%,blkid e2fsck e2p ext2fs uuid)
+APPLETS_DEFINE-y+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
+APPLETS_DEFINE-a+=$(E2FSPROGS_CFLAGS) -I$(E2FSPROGS_SRC) $(E2FSPROGS_TMP_KLUDGE)
$(E2FSPROGS_DIR)/$(E2FSPROGS_AR): $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(E2FSPROGS_DIR)/%, $(E2FSPROGS-y))
diff --git a/editors/Makefile.in b/editors/Makefile.in
index 01fb8b527..114d6200d 100644
--- a/editors/Makefile.in
+++ b/editors/Makefile.in
@@ -15,16 +15,19 @@ EDITOR-$(CONFIG_AWK) += awk.o
EDITOR-$(CONFIG_PATCH) += patch.o
EDITOR-$(CONFIG_SED) += sed.o
EDITOR-$(CONFIG_VI) += vi.o
-EDITOR_SRC:= $(EDITOR-y)
-EDITOR_OBJ:= $(patsubst %.c,$(EDITOR_DIR)%.o, $(EDITOR_SRC))
libraries-y+=$(EDITOR_DIR)$(EDITOR_AR)
+EDITOR_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(EDITOR-y))
+EDITOR_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(EDITOR_SRC-y)
+APPLET_SRC-a+=$(EDITOR_SRC-a)
+
needlibm-y:=
needlibm-$(CONFIG_FEATURE_AWK_MATH) := y
ifeq ($(needlibm-y),y)
- LIBRARIES += -lm
+ LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES))
endif
$(EDITOR_DIR)$(EDITOR_AR): $(patsubst %,$(EDITOR_DIR)%, $(EDITOR-y))
diff --git a/findutils/Makefile.in b/findutils/Makefile.in
index 2dcb702e8..418f43a38 100644
--- a/findutils/Makefile.in
+++ b/findutils/Makefile.in
@@ -17,6 +17,11 @@ FINDUTILS-$(CONFIG_XARGS) += xargs.o
libraries-y+=$(FINDUTILS_DIR)$(FINDUTILS_AR)
+FINDUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(FINDUTILS-y))
+FINDUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(FINDUTILS_SRC-y)
+APPLET_SRC-a+=$(FINDUTILS_SRC-a)
+
$(FINDUTILS_DIR)$(FINDUTILS_AR): $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(FINDUTILS_DIR)%, $(FINDUTILS-y))
diff --git a/include/libbb.h b/include/libbb.h
index e9a828c52..2e697a350 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -86,7 +86,7 @@
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
-extern void bb_show_usage(void) __attribute__ ((noreturn));
+extern void bb_show_usage(void) __attribute__ ((noreturn, externally_visible));
extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
diff --git a/init/Makefile.in b/init/Makefile.in
index 5b3d9eaf0..02d379445 100644
--- a/init/Makefile.in
+++ b/init/Makefile.in
@@ -17,16 +17,16 @@ INIT-$(CONFIG_MESG) += mesg.o
INIT-$(CONFIG_POWEROFF) += poweroff.o
INIT-$(CONFIG_REBOOT) += reboot.o
-ifeq ($(CONFIG_HALT), y)
+ifeq ($(strip $(CONFIG_HALT)),y)
CONFIG_INIT_SHARED=y
else
-ifeq ($(CONFIG_INIT), y)
+ifeq ($(strip $(CONFIG_INIT)),y)
CONFIG_INIT_SHARED=y
else
-ifeq ($(CONFIG_POWEROFF), y)
+ifeq ($(strip $(CONFIG_POWEROFF)),y)
CONFIG_INIT_SHARED=y
else
-ifeq ($(CONFIG_REBOOT), y)
+ifeq ($(strip $(CONFIG_REBOOT)),y)
CONFIG_INIT_SHARED=y
else
CONFIG_INIT_SHARED=n
@@ -35,12 +35,17 @@ endif
endif
endif
-ifeq ($(CONFIG_INIT_SHARED), y)
+ifeq ($(strip $(CONFIG_INIT_SHARED)),y)
INIT-$(CONFIG_INIT_SHARED) += init_shared.o
endif
libraries-y+=$(INIT_DIR)$(INIT_AR)
+INIT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(INIT-y))
+INIT_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(INIT_SRC-y)
+APPLET_SRC-a+=$(INIT_SRC-a)
+
$(INIT_DIR)$(INIT_AR): $(patsubst %,$(INIT_DIR)%, $(INIT-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(INIT_DIR)%, $(INIT-y))
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index 91698a919..bb3790a58 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -4,13 +4,13 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-LIBBB_AR:=libbb.a
ifndef $(LIBBB_DIR)
-LIBBB_DIR:=$(top_builddir)/libbb/
+LIBBB_DIR:=$(top_builddir)/libbb
endif
srcdir=$(top_srcdir)/libbb
-LIBBB_SRC-y:= \
+LIBBB-n:=
+LIBBB-y:= \
bb_asprintf.c ask_confirmation.c change_identity.c chomp.c \
compare_string_array.c concat_path_file.c copy_file.c copyfd.c \
correct_password.c create_icmp_socket.c create_icmp6_socket.c \
@@ -36,10 +36,14 @@ LIBBB_SRC-y:= \
warn_ignoring_args.c concat_subpath_file.c vfork_daemon_rexec.c \
bb_echo.c bb_do_delay.c
-LIBBB_SRC-$(CONFIG_FEATURE_SHADOWPASSWDS)+= pwd2spwd.c
+# conditionally compiled objects:
+LIBBB-$(CONFIG_FEATURE_SHADOWPASSWDS)+=pwd2spwd.c
+LIBBB-$(CONFIG_FEATURE_MTAB_SUPPORT)+= mtab.c
-LIBBB_OBJS=$(patsubst %.c,$(LIBBB_DIR)%.o, $(LIBBB_SRC-y))
+LIBBB-y:=$(patsubst %,$(srcdir)/%,$(LIBBB-y))
+
+# 1:N objects
LIBBB_MSRC0:=$(srcdir)/messages.c
LIBBB_MOBJ0:=full_version.o \
memory_exhausted.o invalid_date.o io_error.o \
@@ -49,65 +53,90 @@ LIBBB_MOBJ0:=full_version.o \
securetty_file.o motd_file.o \
msg_standard_input.o msg_standard_output.o shell_file.o \
bb_dev_null.o bb_common_bufsiz1.o
+LIBBB_MOBJ0:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ0))
+$(LIBBB_MOBJ0):$(LIBBB_MSRC0)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC1:=$(srcdir)/xfuncs.c
LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \
xfopen.o xopen.o xread.o xread_all.o xread_char.o \
xferror.o xferror_stdout.o xfflush_stdout.o strlen.o
+LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1))
+$(LIBBB_MOBJ1):$(LIBBB_MSRC1)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC2:=$(srcdir)/printf.c
LIBBB_MOBJ2:=bb_vfprintf.o bb_vprintf.o bb_fprintf.o bb_printf.o
+LIBBB_MOBJ2:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ2))
+$(LIBBB_MOBJ2):$(LIBBB_MSRC2)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC3:=$(srcdir)/xgetularg.c
LIBBB_MOBJ3:=xgetularg_bnd_sfx.o xgetlarg_bnd_sfx.o getlarg10_sfx.o \
xgetularg_bnd.o xgetularg10_bnd.o xgetularg10.o
+LIBBB_MOBJ3:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ3))
+$(LIBBB_MOBJ3):$(LIBBB_MSRC3)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC4:=$(srcdir)/safe_strtol.c
LIBBB_MOBJ4:=safe_strtoi.o safe_strtod.o safe_strtol.o safe_strtoul.o
+LIBBB_MOBJ4:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ4))
+$(LIBBB_MOBJ4):$(LIBBB_MSRC4)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC5:=$(srcdir)/bb_pwd.c
LIBBB_MOBJ5:=bb_xgetpwnam.o bb_xgetgrnam.o bb_getgrgid.o bb_getpwuid.o \
bb_getug.o get_ug_id.o
+LIBBB_MOBJ5:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ5))
+$(LIBBB_MOBJ5):$(LIBBB_MSRC5)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
LIBBB_MSRC6:=$(srcdir)/llist.c
LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o
+LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6))
+$(LIBBB_MOBJ6):$(LIBBB_MSRC6)
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -o $@ -c $<
-LIBBB_MOBJS0=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ0))
-LIBBB_MOBJS1=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ1))
-LIBBB_MOBJS2=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ2))
-LIBBB_MOBJS3=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ3))
-LIBBB_MOBJS4=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ4))
-LIBBB_MOBJS5=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ5))
-LIBBB_MOBJS6=$(patsubst %,$(LIBBB_DIR)%, $(LIBBB_MOBJ6))
-libraries-y+=$(LIBBB_DIR)$(LIBBB_AR)
+# We need the names of the object files built from MSRC for the L_ defines
+LIBBB_ALL_MOBJ:=$(LIBBB_MOBJ0) $(LIBBB_MOBJ1) $(LIBBB_MOBJ2) $(LIBBB_MOBJ3) $(LIBBB_MOBJ4) $(LIBBB_MOBJ5) $(LIBBB_MOBJ6)
-$(LIBBB_DIR)$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_MOBJS0) $(LIBBB_MOBJS1) \
- $(LIBBB_MOBJS2) $(LIBBB_MOBJS3) $(LIBBB_MOBJS4) $(LIBBB_MOBJS5) \
- $(LIBBB_MOBJS6)
- $(AR) $(ARFLAGS) $(@) $(LIBBB_OBJS) $(^)
+LIBBB_ALL_MSRC:=$(LIBBB_MSRC0) $(LIBBB_MSRC1) $(LIBBB_MSRC2) $(LIBBB_MSRC3) \
+ $(LIBBB_MSRC4) $(LIBBB_MSRC5) $(LIBBB_MSRC6)
-$(LIBBB_DIR)%.o: $(srcdir)/%.c
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
+LIBBB-y:=$(sort $(LIBBB-y) $(LIBBB_ALL_MSRC))
-$(LIBBB_MOBJS0): $(LIBBB_MSRC0)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+LIBBB_AR:=$(LIBBB_DIR)/libbb.a
+libraries-y+=$(LIBBB_AR)
-$(LIBBB_MOBJS1): $(LIBBB_MSRC1)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+needcrypt-y:=
+ifneq ($(findstring $(srcdir)/pw_encrypt.c,$(LIBBB-y)),)
+needcrypt-y:=y
+else
+ifneq ($(findstring $(srcdir)/correct_password.c,$(LIBBB-y)),)
+needcrypt-y:=y
+endif
+endif
+
+ifeq ($(needcrypt-y),y)
+ LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
+endif
-$(LIBBB_MOBJS2): $(LIBBB_MSRC2)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+# all 1:1 objects
+LIBBB_OBJS:=$(patsubst $(srcdir)/%.c,$(LIBBB_DIR)/%.o, $(LIBBB-y))
+$(LIBBB_DIR)/%.o: $(srcdir)/%.c
+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -o $@ -c $<
-$(LIBBB_MOBJS3): $(LIBBB_MSRC3)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
-$(LIBBB_MOBJS4): $(LIBBB_MSRC4)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+LIBBB_SRC-a:=$(wildcard $(srcdir)/*.c)
+LIBRARY_SRC-y+=$(LIBBB-y)
+LIBRARY_SRC-a+=$(LIBBB_SRC-a)
-$(LIBBB_MOBJS5): $(LIBBB_MSRC5)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+# all defines needed for 1:N objects
+LIBBB_DEFINE-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBBB_ALL_MOBJ))))
+LIBRARY_DEFINE-y+=$(LIBBB_DEFINE-y)
+LIBRARY_DEFINE-a+=$(LIBBB_DEFINE-y)
-$(LIBBB_MOBJS6): $(LIBBB_MSRC6)
- $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
+$(LIBBB_AR): $(LIBBB_OBJS) $(LIBBB_ALL_MOBJ)
+ $(AR) $(ARFLAGS) $(@) $(^)
diff --git a/libbb/find_mount_point.c b/libbb/find_mount_point.c
index eec738aea..4d27b4809 100644
--- a/libbb/find_mount_point.c
+++ b/libbb/find_mount_point.c
@@ -48,11 +48,12 @@ extern struct mntent *find_mount_point(const char *name, const char *table)
mountDevice = s.st_dev;
- if ((mountTable = setmntent(table ? : bb_path_mtab_file, "r")) == 0)
+ if ((mountTable = setmntent(table ? table : bb_path_mtab_file, "r")) == 0)
return 0;
while ((mountEntry = getmntent(mountTable)) != 0) {
- if (strcmp(name, mountEntry->mnt_dir) == 0
+
+ if(strcmp(name, mountEntry->mnt_dir) == 0
|| strcmp(name, mountEntry->mnt_fsname) == 0) /* String match. */
break;
if (stat(mountEntry->mnt_fsname, &s) == 0 && s.st_rdev == mountDevice) /* Match the device. */
diff --git a/libpwdgrp/Makefile.in b/libpwdgrp/Makefile.in
index 99674804c..550611681 100644
--- a/libpwdgrp/Makefile.in
+++ b/libpwdgrp/Makefile.in
@@ -6,10 +6,15 @@
LIBPWDGRP_AR:=libpwdgrp.a
ifndef $(LIBPWDGRP_DIR)
-LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp/
+LIBPWDGRP_DIR:=$(top_builddir)/libpwdgrp
endif
srcdir=$(top_srcdir)/libpwdgrp
+LIBPWDGRP-obj:=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR)
+LIBPWDGRP-pic:=$(LIBPWDGRP_DIR)/$(subst .a,-pic.o,$(LIBPWDGRP_AR))
+
+libraries-y+=$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR)
+libraries-m+=$(LIBPWDGRP-multi-pic)
LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \
@@ -17,19 +22,29 @@ LIBPWDGRP_MOBJ0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r.o fgetgrent_r.o \
getgrgid_r.o getpwuid.o getgrgid.o getpwnam.o getgrnam.o getpw.o \
getpwent_r.o getgrent_r.o getpwent.o getgrent.o \
initgroups.o putpwent.o putgrent.o
-LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)%, $(LIBPWDGRP_MOBJ0-y))
+LIBPWDGRP_MOBJS0=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ0-y))
LIBPWDGRP_MSRC1:=$(srcdir)/pwd_grp.c
LIBPWDGRP_MOBJ1-$(CONFIG_USE_BB_PWD_GRP):= __parsepwent.o __parsegrent.o \
__pgsreader.o fgetspent_r.o fgetspent.o sgetspent_r.o getspnam_r.o \
getspnam.o getspent_r.o getspent.o sgetspent.o \
putspent.o __parsespent.o # getspuid_r.o getspuid.o
-LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)%, $(LIBPWDGRP_MOBJ1-y))
+LIBPWDGRP_MOBJS1=$(patsubst %,$(LIBPWDGRP_DIR)/%, $(LIBPWDGRP_MOBJ1-y))
+
+LIBPWDGRP_DEFINE0-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS0))))
+LIBPWDGRP_DEFINE1-y:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(LIBPWDGRP_MOBJS1))))
+
+LIBPWDGRP_SRC-y:=$(LIBPWDGRP_MSRC0)
+
+LIBRARY_SRC-y+=$(LIBPWDGRP_SRC-y)
+LIBRARY_SRC-a+=$(LIBPWDGRP_SRC-y)
+
+LIBRARY_DEFINE-y+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y)
+LIBRARY_DEFINE-a+=$(LIBPWDGRP_DEFINE0-y) $(LIBPWDGRP_DEFINE1-y)
-libraries-y+=$(LIBPWDGRP_DIR)$(LIBPWDGRP_AR)
-$(LIBPWDGRP_DIR)$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1)
- $(AR) $(ARFLAGS) $@ $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1)
+$(LIBPWDGRP_DIR)/$(LIBPWDGRP_AR): $(LIBPWDGRP_MOBJS0) $(LIBPWDGRP_MOBJS1)
+ $(AR) $(ARFLAGS) $(@) $(^)
$(LIBPWDGRP_MOBJS0): $(LIBPWDGRP_MSRC0)
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DL_$(notdir $*) -c $< -o $@
diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in
index c17865732..a2cfd8a67 100644
--- a/loginutils/Makefile.in
+++ b/loginutils/Makefile.in
@@ -24,6 +24,11 @@ LOGINUTILS-$(CONFIG_DELGROUP) += delgroup.o
libraries-y+=$(LOGINUTILS_DIR)$(LOGINUTILS_AR)
+LOGINUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(LOGINUTILS-y))
+LOGINUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(LOGINUTILS_SRC-y)
+APPLET_SRC-a+=$(LOGINUTILS_SRC-a)
+
needcrypt-y:=
needcrypt-$(CONFIG_LOGIN) := y
needcrypt-$(CONFIG_PASSWD) := y
@@ -33,7 +38,7 @@ needcrypt-$(CONFIG_VLOCK) := y
ifeq ($(needcrypt-y),y)
- LIBRARIES += -lcrypt
+ LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
endif
$(LOGINUTILS_DIR)$(LOGINUTILS_AR): $(patsubst %,$(LOGINUTILS_DIR)%, $(LOGINUTILS-y))
diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in
index 5bd522c11..6cd2b022c 100644
--- a/miscutils/Makefile.in
+++ b/miscutils/Makefile.in
@@ -33,11 +33,16 @@ MISCUTILS-$(CONFIG_WATCHDOG) += watchdog.o
libraries-y+=$(MISCUTILS_DIR)$(MISCUTILS_AR)
+MISCUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MISCUTILS-y))
+MISCUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(MISCUTILS_SRC-y)
+APPLET_SRC-a+=$(MISCUTILS_SRC-a)
+
needlibm-y:=
needlibm-$(CONFIG_DC) := y
ifeq ($(needlibm-y),y)
- LIBRARIES += -lm
+ LIBRARIES := -lm $(filter-out -lm,$(LIBRARIES))
endif
$(MISCUTILS_DIR)$(MISCUTILS_AR): $(patsubst %,$(MISCUTILS_DIR)%, $(MISCUTILS-y))
diff --git a/modutils/Makefile.in b/modutils/Makefile.in
index df754afd2..f9934816e 100644
--- a/modutils/Makefile.in
+++ b/modutils/Makefile.in
@@ -18,6 +18,11 @@ MODUTILS-$(CONFIG_RMMOD) += rmmod.o
libraries-y+=$(MODUTILS_DIR)$(MODUTILS_AR)
+MODUTILS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(MODUTILS-y))
+MODUTILS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(MODUTILS_SRC-y)
+APPLET_SRC-a+=$(MODUTILS_SRC-a)
+
$(MODUTILS_DIR)$(MODUTILS_AR): $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(MODUTILS_DIR)%, $(MODUTILS-y))
diff --git a/networking/Makefile.in b/networking/Makefile.in
index 376ecea63..2263acc00 100644
--- a/networking/Makefile.in
+++ b/networking/Makefile.in
@@ -9,6 +9,7 @@ ifndef $(NETWORKING_DIR)
NETWORKING_DIR:=$(top_builddir)/networking/
endif
srcdir=$(top_srcdir)/networking
+
NETWORKING-y:=
NETWORKING-$(CONFIG_ARPING) += arping.o
NETWORKING-$(CONFIG_ETHER_WAKE) += ether-wake.o
@@ -41,13 +42,22 @@ NETWORKING-$(CONFIG_VCONFIG) += vconfig.o
NETWORKING-$(CONFIG_WGET) += wget.o
NETWORKING-$(CONFIG_ZCIP) += zcip.o
+NETWORKING-y:=$(sort $(NETWORKING-y))
libraries-y+=$(NETWORKING_DIR)$(NETWORKING_AR)
+NETWORKING_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(NETWORKING-y))
+NETWORKING_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(NETWORKING_SRC-y)
+APPLET_SRC-a+=$(NETWORKING_SRC-a)
+
+LIBRARY_DEFINE-y+= -I$(top_srcdir)/networking
+LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking
+
needcrypt-y:=
needcrypt-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) := y
ifeq ($(needcrypt-y),y)
- LIBRARIES += -lcrypt
+ LIBRARIES := -lcrypt $(filter-out -lcrypt,$(LIBRARIES))
endif
$(NETWORKING_DIR)$(NETWORKING_AR): $(patsubst %,$(NETWORKING_DIR)%, $(NETWORKING-y))
diff --git a/networking/libiproute/Makefile.in b/networking/libiproute/Makefile.in
index a28af4611..37d556dd9 100644
--- a/networking/libiproute/Makefile.in
+++ b/networking/libiproute/Makefile.in
@@ -2,27 +2,16 @@
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
#
LIBIPROUTE_AR:=libiproute.a
ifndef $(LIBIPROUTE_DIR)
-LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute/
+LIBIPROUTE_DIR:=$(top_builddir)/networking/libiproute
endif
srcdir=$(top_srcdir)/networking/libiproute
+LIBIPROUTE-y:=
LIBIPROUTE-$(CONFIG_IP) += \
ip_parse_common_args.o \
ipaddress.o \
@@ -74,11 +63,31 @@ LIBIPROUTE-$(CONFIG_IPTUNNEL) += \
rt_names.o \
utils.o
-libraries-y+=$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR)
+LIBIPROUTE-y:=$(sort $(LIBIPROUTE-y))
+
+LIBIPROUTE_SRC-y:=$(patsubst %,$(srcdir)/%,$(subst .o,.c,$(LIBIPROUTE-y)))
+LIBIPROUTE_SRC-a:=$(wildcard $(srcdir)/*.c)
+LIBRARY_SRC-y+=$(LIBIPROUTE_SRC-y)
+LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a)
+
+LIBIPROUTE-obj:=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR)
+
+# We do not need to build an empty non-pic object/archive
+ifneq ($(strip $(LIBIPROUTE-y)),)
+libraries-y+=$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR)
+endif
+
+# If we are building libbusybox.so _and_ we will use it ourselves then we
+# keep it as small as possible
+ifeq ($(strip $(CONFIG_FEATURE_SHARED_BUSYBOX)),y)
+ifneq ($(strip $(LIBIPROUTE-y)),)
+libraries-m+=$(LIBIPROUTE-multi-pic)
+endif
+endif
-$(LIBIPROUTE_DIR)$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y))
- $(AR) $(ARFLAGS) $@ $(patsubst %,$(LIBIPROUTE_DIR)%, $(LIBIPROUTE-y))
+$(LIBIPROUTE_DIR)/$(LIBIPROUTE_AR): $(patsubst %,$(LIBIPROUTE_DIR)/%,$(LIBIPROUTE-y))
+ $(AR) $(ARFLAGS) $@ $(^)
-$(LIBIPROUTE_DIR)%.o: $(srcdir)/%.c
+$(LIBIPROUTE_DIR)/%.o: $(srcdir)/%.c
$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
diff --git a/networking/udhcp/Makefile.in b/networking/udhcp/Makefile.in
index ac9be5c57..8573a2fc4 100644
--- a/networking/udhcp/Makefile.in
+++ b/networking/udhcp/Makefile.in
@@ -2,19 +2,7 @@
#
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
#
UDHCP_AR:=udhcp.a
@@ -24,10 +12,10 @@ endif
srcdir=$(top_srcdir)/networking/udhcp
#ok, so I forgot how to do an or, but this is a quick and dirty hack
-ifeq ($(CONFIG_UDHCPC), y)
+ifeq ($(strip $(CONFIG_UDHCPC)),y)
CONFIG_UDHCP_SHARED=y
else
-ifeq ($(CONFIG_UDHCPD), y)
+ifeq ($(strip $(CONFIG_UDHCPD)),y)
CONFIG_UDHCP_SHARED=y
else
CONFIG_UDHCP_SHARED=n
@@ -42,10 +30,20 @@ UDHCP-$(CONFIG_UDHCPC) += dhcpc.c clientpacket.c clientsocket.c \
UDHCP-$(CONFIG_UDHCPD) += dhcpd.c arpping.c files.c leases.c \
serverpacket.c static_leases.c
UDHCP-$(CONFIG_DUMPLEASES) += dumpleases.c
-UDHCP_OBJS=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y))
+UDHCP_OBJS:=$(patsubst %.c,$(UDHCP_DIR)%.o, $(UDHCP-y))
libraries-y+=$(UDHCP_DIR)$(UDHCP_AR)
+UDHCP-y:=$(patsubst %,$(srcdir)/%,$(UDHCP-y))
+UDHCP-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(UDHCP-y)
+APPLET_SRC-a+=$(UDHCP-a)
+
+UDHCP_INCLUDES:=$(srcdir)
+
+APPLETS_DEFINE-y+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES)
+APPLETS_DEFINE-a+=-DIN_BUSYBOX -I$(UDHCP_INCLUDES)
+
$(UDHCP_DIR)$(UDHCP_AR): $(UDHCP_OBJS)
$(AR) $(ARFLAGS) $@ $(UDHCP_OBJS)
diff --git a/procps/Makefile.in b/procps/Makefile.in
index 782944e8f..b7eb7dca1 100644
--- a/procps/Makefile.in
+++ b/procps/Makefile.in
@@ -23,6 +23,11 @@ PROCPS-$(CONFIG_FUSER) += fuser.o
libraries-y+=$(PROCPS_DIR)$(PROCPS_AR)
+PROCPS_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(PROCPS-y))
+PROCPS_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(PROCPS_SRC-y)
+APPLET_SRC-a+=$(PROCPS_SRC-a)
+
$(PROCPS_DIR)$(PROCPS_AR): $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(PROCPS_DIR)%, $(PROCPS-y))
diff --git a/shell/Makefile.in b/shell/Makefile.in
index db01a152a..f61f90a1a 100644
--- a/shell/Makefile.in
+++ b/shell/Makefile.in
@@ -19,6 +19,11 @@ SHELLT-$(CONFIG_FEATURE_COMMAND_EDITING) += cmdedit.o
libraries-y+=$(SHELL_DIR)$(SHELL_AR)
+SHELLT_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SHELLT-y))
+SHELLT_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(SHELLT_SRC-y)
+APPLET_SRC-a+=$(SHELLT_SRC-a)
+
$(SHELL_DIR)$(SHELL_AR): $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(SHELL_DIR)%, $(SHELLT-y))
diff --git a/sysdeps/linux/Config.in b/sysdeps/linux/Config.in
index 3501ff767..1b87c1251 100644
--- a/sysdeps/linux/Config.in
+++ b/sysdeps/linux/Config.in
@@ -164,6 +164,35 @@ config CONFIG_STATIC
Most people will leave this set to 'N'.
+config CONFIG_BUILD_LIBBUSYBOX
+ bool "Build shared libbusybox"
+ default y
+ help
+ Build a shared library libbusybox.so which contains all
+ libraries used inside busybox.
+
+config CONFIG_FEATURE_FULL_LIBBUSYBOX
+ bool "Feature-complete libbusybox"
+ default n if !CONFIG_FEATURE_SHARED_BUSYBOX
+ depends on CONFIG_BUILD_LIBBUSYBOX
+ help
+ Build a libbusybox with the complete feature-set, disregarding
+ the actually selected config.
+
+ Normally, libbusybox will only contain the features which are
+ used by busybox itself. If you plan to write a separate
+ standalone application which uses libbusybox say 'Y'.
+
+ Say 'N' if in doubt.
+
+config CONFIG_FEATURE_SHARED_BUSYBOX
+ bool "Use shared libbusybox for busybox"
+ default y if CONFIG_BUILD_LIBBUSYBOX
+ depends on !CONFIG_STATIC && CONFIG_BUILD_LIBBUSYBOX
+ help
+ Use libbusybox.so also for busybox itself.
+ You need to have a working dynamic linker to use this variant.
+
config CONFIG_LFS
bool "Build with Large File Support (for accessing files > 2 GB)"
default n
@@ -203,6 +232,25 @@ config EXTRA_CFLAGS_OPTIONS
if you want to add some simple compiler switches (like -march=i686),
or check for warnings using -Werror, just those options here.
+config CONFIG_BUILD_AT_ONCE
+ bool "Compile all sources at once"
+ default n
+ help
+ Normally each source-file is compiled with one invocation of
+ the compiler.
+ If you set this option, all sources are compiled at once.
+ This gives the compiler more opportunities to optimize which can
+ result in smaller and/or faster binaries.
+
+ Setting this option will consume alot of memory, e.g. if you
+ enable all applets with all features, gcc uses more than 300MB
+ RAM during compilation of busybox.
+
+ This option is most likely only beneficial for newer compilers
+ such as gcc-4.1 and above.
+
+ Say 'N' unless you know what you are doing.
+
config CONFIG_FEATURE_SUSv2
bool "Enable features that are in SuSv2 but not SuSv3?"
default y
@@ -216,7 +264,9 @@ config CONFIG_FEATURE_SUSv2_OBSOLETE
depends on CONFIG_FEATURE_SUSv2
default y
help
- Disables support for numeric arguments in fold.
+ Enable pre- SuSv2 features which are deprecated in SuSv2 and
+ above.
+ Disables support for e.g. numeric arguments in fold.
endmenu
@@ -264,26 +314,24 @@ config PREFIX
help
Define your directory to install BusyBox files/subdirs in.
-
-
endmenu
source archival/Config.in
source coreutils/Config.in
source console-tools/Config.in
source debianutils/Config.in
-source e2fsprogs/Config.in
source editors/Config.in
source findutils/Config.in
source init/Config.in
source loginutils/Config.in
-source miscutils/Config.in
+source e2fsprogs/Config.in
source modutils/Config.in
+source util-linux/Config.in
+source miscutils/Config.in
source networking/Config.in
source procps/Config.in
source shell/Config.in
source sysklogd/Config.in
-source util-linux/Config.in
menu 'Debugging Options'
diff --git a/sysklogd/Makefile.in b/sysklogd/Makefile.in
index e6d47f6b5..2b913f784 100644
--- a/sysklogd/Makefile.in
+++ b/sysklogd/Makefile.in
@@ -18,6 +18,11 @@ SYSKLOGD-$(CONFIG_SYSLOGD) += syslogd.o
libraries-y+=$(SYSKLOGD_DIR)$(SYSKLOGD_AR)
+SYSKLOGD_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(SYSKLOGD-y))
+SYSKLOGD_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(SYSKLOGD_SRC-y)
+APPLET_SRC-a+=$(SYSKLOGD_SRC-a)
+
$(SYSKLOGD_DIR)$(SYSKLOGD_AR): $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(SYSKLOGD_DIR)%, $(SYSKLOGD-y))
diff --git a/util-linux/Makefile.in b/util-linux/Makefile.in
index 176930246..de7e210ba 100644
--- a/util-linux/Makefile.in
+++ b/util-linux/Makefile.in
@@ -37,8 +37,14 @@ UTILLINUX-$(CONFIG_SWAPONOFF) +=swaponoff.o
UTILLINUX-$(CONFIG_SWITCH_ROOT) +=switch_root.o
UTILLINUX-$(CONFIG_UMOUNT) +=umount.o
+
libraries-y+=$(UTILLINUX_DIR)$(UTILLINUX_AR)
+UTILLINUX_SRC-y:=$(patsubst %.o,$(srcdir)/%.c,$(UTILLINUX-y))
+UTILLINUX_SRC-a:=$(wildcard $(srcdir)/*.c)
+APPLET_SRC-y+=$(UTILLINUX_SRC-y)
+APPLET_SRC-a+=$(UTILLINUX_SRC-a)
+
$(UTILLINUX_DIR)$(UTILLINUX_AR): $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y))
$(AR) $(ARFLAGS) $@ $(patsubst %,$(UTILLINUX_DIR)%, $(UTILLINUX-y))