+
+if test "$CONFIG_FEATURE_INDIVIDUAL" = y; then
+ echo "Linking individual applets against libbusybox (see $sharedlib_dir/*)"
+ gcc -DNAME_MAIN_CNAME -E -include include/autoconf.h include/applets.h \
+ | grep -v "^#" \
+ | grep -v "^$" \
+ > applet_lst.tmp
+ while read name main junk; do
+
+ echo "\
+void lbb_prepare(const char *applet, char **argv);
+int $main(int argc, char **argv);
+
+int main(int argc, char **argv)
+{
+ lbb_prepare(\"$name\", argv);
+ return $main(argc, argv);
+}
+" >"$sharedlib_dir/applet.c"
+
+ EXE="$sharedlib_dir/$name"
+ try $CC $CFLAGS $LDFLAGS "$sharedlib_dir/applet.c" \
+ -o $EXE \
+ -Wl,--sort-common \
+ $SORT_SECTION \
+ $GC_SECTIONS \
+ -L"$sharedlib_dir" -lbusybox \
+ -Wl,--warn-common \
+ || {
+ echo "Linking $EXE failed"
+ cat $EXE.out
+ exit 1
+ }
+ rm -- "$sharedlib_dir/applet.c" $EXE.out
+ $STRIP -s --remove-section=.note --remove-section=.comment $EXE
+
+ done <applet_lst.tmp
+fi
+
+# libbusybox.so is needed only for -lbusybox at link time,
+# it is not needed at runtime. Deleting to reduce confusion.
+rm "$sharedlib_dir"/libbusybox.so 2>/dev/null
+exit 0 # or else we may confuse make