aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile122
-rw-r--r--Rules.mak56
-rw-r--r--applets/Makefile.in8
-rw-r--r--archival/Makefile.in8
-rw-r--r--archival/libunarchive/Makefile.in8
-rw-r--r--console-tools/Makefile.in8
-rw-r--r--coreutils/Makefile.in8
-rw-r--r--coreutils/libcoreutils/Makefile.in9
-rw-r--r--debianutils/Makefile.in8
-rw-r--r--e2fsprogs/Makefile.in45
-rw-r--r--editors/Makefile.in8
-rw-r--r--findutils/Makefile.in8
-rw-r--r--init/Makefile.in8
-rw-r--r--libbb/Makefile.in9
-rw-r--r--libpwdgrp/Makefile.in8
-rw-r--r--loginutils/Makefile.in8
-rw-r--r--miscutils/Makefile.in8
-rw-r--r--modutils/Makefile.in8
-rw-r--r--networking/Makefile.in8
-rw-r--r--networking/libiproute/Makefile.in9
-rw-r--r--networking/udhcp/Makefile.in8
-rw-r--r--procps/Makefile.in8
-rw-r--r--shell/Makefile.in8
-rw-r--r--sysklogd/Makefile.in8
-rw-r--r--util-linux/Makefile.in8
25 files changed, 236 insertions, 166 deletions
diff --git a/Makefile b/Makefile
index fffc52466..7fcdd45e5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,15 +13,16 @@ noconfig_targets := menuconfig config oldconfig randconfig \
clean distclean \
release tags
-# make-3.79.1 didn't support MAKEFILE_LIST
-# for building out-of-tree, users of make-3.79 still have to pass top_srcdir=
-# to make: make -f /srcs/busybox/Makefile top_srcdir=/srcs/busybox
-ifndef MAKEFILE_LIST
-MAKEFILE_LIST=.
-endif
# the toplevel sourcedir
ifndef top_srcdir
+# make-3.79.1 didn't support MAKEFILE_LIST
+# for building out-of-tree, users of make-3.79.1 still have to pass top_srcdir=
+# to make: make -f /srcs/busybox/Makefile top_srcdir=/srcs/busybox
+ifdef MAKEFILE_LIST
top_srcdir:=$(shell cd $(dir $(firstword $(MAKEFILE_LIST))) && pwd)
+else
+top_srcdir:=$(CURDIR)
+endif
endif
# toplevel directory of the object-tree
ifndef top_builddir
@@ -63,44 +64,22 @@ else
PACKAGE_OUTPUTDIR := $(top_builddir)
endif
-#######################################################################
-# Try to workaround bugs in make
-
-# make-3.79.1 didn't understand order-only prerequisites ('|').
-# Just treat them as normal prerequisites. Note that this will lead to
-# spurious rebuilds.
-ifeq ($(MAKE_VERSION),3.79.1)
-|: ;
-endif
-
-# Workaround for bugs in make-3.80
-# eval is broken if it is in a conditional
-
-#$ cat 3.80-eval-in-cond.mak
-#all:: ; @echo it
-#define Y
-# all:: ; @echo worked
-#endef
-#ifdef BAR
-#$(eval $(Y))
-#endif
-#$ make -f 3.80-eval-in-cond.mak
-#it
-#$ make -f 3.80-eval-in-cond.mak BAR=set
-#3.80-eval-in-cond.mak:5: *** missing `endif'. Stop.
-
-# This was fixed in December 2003.
define check_gcc
-$(eval $(1)+=$(if $(2),$(if $(shell $(CC) $(2) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 && echo y),$(2),$(if $(3),$(3))),$(if $(3),$(3))))
+$(if $(2),$(if $(shell $(CC) $(2) -S -o /dev/null -xc /dev/null > /dev/null 2>&1 && echo y),$(2),$(if $(3),$(3))),$(if $(3),$(3)))
endef
define check_ld
-$(eval $(1)+=$(if $(2),$(if $(shell $(LD) $(2) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && echo y),$(shell echo \-Wl,$(2)),$(if $(3),$(3))),$(if $(3),$(3))))
+$(if $(2),$(if $(shell $(LD) $(2) -o /dev/null -b binary /dev/null > /dev/null 2>&1 && echo y),$(shell echo \-Wl,$(2)),$(if $(3),$(3))),$(if $(3),$(3)))
endef
#######################################################################
+# make-3.79.1 doesn't support order-only prerequisites..
+ifeq ($(MAKE_VERSION),3.79.1)
+|: $(^) ;
+endif
+#######################################################################
+
--include $(top_srcdir)/Rules.mak
# Handle building out of tree
ifneq ($(top_builddir),$(top_srcdir))
@@ -179,6 +158,8 @@ help:
@echo ' 2 also print when make enters a directory'
@echo ' 3 also verbosely print shell invocations'
+-include $(top_srcdir)/Rules.mak
+
ifneq ($(strip $(HAVE_DOT_CONFIG)),y)
# Default target if none was requested explicitly
all: defconfig menuconfig ;
@@ -252,33 +233,8 @@ ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
endif # ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
-# convert $(DIRS) to upper case. Use sed instead of tr since we're already
-# depending on it.
-DIRS_UPPER:=$(shell echo $(DIRS) | $(SED) 'h;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/')
-
-# First populate the variables ..._OBJ-y et al
-$(foreach d,$(DIRS_UPPER),$(eval $(notdir $(d))-y:=))
-
include $(patsubst %,%/Makefile.in,$(SRC_DIRS))
-# Then we need the dependencies for ..._OBJ
-define dir_pattern.o
-ifeq ($(os),.os)
-$(if $($(1)_OBJ.os),$($(1)_OBJ.os:.os=.o): $(top_builddir)/$(2)/%.o: $(top_srcdir)/$(2)/%.c)
-endif
-$(if $($(1)_OBJ$(os)),$($(1)_OBJ$(os)): $(top_builddir)/$(2)/%$(os): $(top_srcdir)/$(2)/%.c)
-$(if $($(1)_OBJ),$($(1)_OBJ): $(top_builddir)/$(2)/%.o: $(top_srcdir)/$(2)/%.c)
-endef
-
-# The actual directory patterns for .o*
-$(foreach d,$(DIRS),$(eval $(call dir_pattern.o,$(subst /,_,$(d)),$(d))))
-
-define file_lists
-$($(1)$(2)) $($(1)$(2).o) $($(1)$(2).os)
-endef
-bin-obj-y:=$(subst .os,.o,$(foreach d,$(DIRS),$(call file_lists,$(subst /,_,$(d)),_OBJ)))
-bin-mobj-y:=$(subst .osm,.om,$(foreach d,$(DIRS),$(call file_lists,$(subst /,_,$(d)),_MOBJ)))
-
ifeq ($(strip $(HAVE_DOT_CONFIG)),y)
# Finally pull in the dependencies (headers and other includes) of the
# individual object files
@@ -294,9 +250,7 @@ all: busybox busybox.links doc ;
# IMA compiles all sources at once (aka IPO aka IPA etc.)
ifeq ($(strip $(CONFIG_BUILD_AT_ONCE)),y)
-# We are not building .o
-bin-obj-y:=
-bin-mobj-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.
@@ -312,30 +266,17 @@ 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_OBJ$(os)) \
- $(networking_libiproute_OBJ$(os)) \
- $(libpwdgrp_MOBJ$(os)) \
- $(coreutils_libcoreutils_OBJ$(os)) \
- $(libbb_OBJ$(os)) $(libbb_MOBJ$(os))
-
+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 .o already contained in the .so
-bin-obj-y:=$(filter-out $(libbusybox-obj) $(libbusybox-obj:.os=.o),$(bin-obj-y))
-bin-mobj-y:=$(filter-out $(libbusybox-obj) $(libbusybox-obj:.osm=.om),$(bin-mobj-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
-
-# build an .a to keep .hash et al small
-ifneq ($(bin-obj-y)$(bin-mobj-y),)
- applets.a:=$(bin-obj-y) $(bin-mobj-y)
-endif
-ifdef applets.a
-applets.a: $(applets.a)
- $(Q)-rm -f $(@)
- $(do_ar)
-bin-obj.a=applets.a
-endif
+endif # CONFIG_BUILD_AT_ONCE
ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
LD_LIBBUSYBOX:=libbusybox.so
@@ -355,6 +296,8 @@ endif # !CONFIG_FEATURE_SHARED_BUSYBOX
$(LIBBUSYBOX_SONAME): $(LIBRARY_SRC)
else # CONFIG_BUILD_AT_ONCE
$(LIBBUSYBOX_SONAME): $(libbusybox-obj)
+AR_INTRO:=-Wl,--whole-archive
+AR_EXTRO:=-Wl,--no-whole-archive
endif # CONFIG_BUILD_AT_ONCE
@@ -367,12 +310,12 @@ $(LIBBUSYBOX_SONAME):
ifndef MAJOR_VERSION
$(error MAJOR_VERSION needed for $@ is not defined)
endif
- $(do_link) $(LIB_CFLAGS) $(LIB_LDFLAGS) $(CFLAGS_COMBINE) \
+ $(do_link) $(LIB_CFLAGS) $(CFLAGS_COMBINE) \
-Wl,-soname=$(LD_LIBBUSYBOX).$(MAJOR_VERSION) \
-Wl,-z,combreloc $(LIB_LDFLAGS) \
-o $(@) \
-Wl,--start-group \
- $(LIBRARY_DEFINE) $(^) \
+ $(LIBRARY_DEFINE) $(AR_INTRO) $(^) $(AR_EXTRO) \
-Wl,--end-group
@rm -f $(DO_INSTALL_LIBS)
@for i in $(DO_INSTALL_LIBS); do ln -s $(@) $$i ; done
@@ -380,14 +323,14 @@ endif
endif # ifeq ($(strip $(CONFIG_BUILD_LIBBUSYBOX)),y)
-busybox_unstripped: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(bin-obj.a)
+busybox_unstripped: $(top_builddir)/.depend $(LIBBUSYBOX_SONAME) $(BUSYBOX_SRC) $(APPLET_SRC) $(libraries-y)
$(do_link) $(PROG_CFLAGS) $(PROG_LDFLAGS) $(CFLAGS_COMBINE) \
$(foreach f,$(^:.o=.c),$(CFLAGS-$(notdir $(patsubst %/$,%,$(dir $(f))))-$(notdir $(f)))) \
$(CFLAGS-$(@)) \
-o $@ -Wl,--start-group \
$(APPLETS_DEFINE) $(APPLET_SRC) \
$(BUSYBOX_DEFINE) $(BUSYBOX_SRC) \
- $(bin-obj.a) \
+ $(libraries-y) \
$(LDBUSYBOX) $(LIBRARIES) \
-Wl,--end-group
@@ -538,3 +481,4 @@ tags:
defconfig allyesconfig allnoconfig allbareconfig \
clean distclean \
release tags
+
diff --git a/Rules.mak b/Rules.mak
index 51c9baeab..43a9ef1d2 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -71,6 +71,16 @@ HOSTCFLAGS= -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
# Ensure consistent sort order, 'gcc -print-search-dirs' behavior, etc.
LC_ALL:= C
+# initialize flags here
+CFLAGS:=
+CFLAGS_COMBINE:=
+CFLAGS_PIC:=
+LD_FLAGS:=
+LIB_LDFLAGS:=
+PROG_LDFLAGS:=
+PROG_CFLAGS:=
+OPTIMIZATIONS:=
+
# If you want to add some simple compiler switches (like -march=i686),
# especially from the command line, use this instead of CFLAGS directly.
# For optimization overrides, it's better still to set OPTIMIZATIONS.
@@ -94,7 +104,7 @@ CFLAGS_EXTRA=$(subst ",, $(strip $(EXTRA_CFLAGS_OPTIONS)))
WARNINGS=-Wall -Wstrict-prototypes -Wshadow
CFLAGS+=-I$(top_builddir)/include -I$(top_srcdir)/include
-ARFLAGS=cruP
+ARFLAGS=cru
@@ -149,8 +159,8 @@ __TARGET_ARCH:=$(shell $(CC) -dumpmachine | sed -e s'/-.*//' \
)
endif
-$(call check_gcc,CFLAGS,-funsigned-char,)
-$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
+CFLAGS+=$(call check_gcc,CFLAGS,-funsigned-char,)
+CFLAGS+=$(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
#--------------------------------------------------------
# Arch specific compiler optimization stuff should go here.
@@ -158,51 +168,51 @@ $(call check_gcc,CFLAGS,-mmax-stack-frame=256,)
# for OPTIMIZATIONS...
# use '-Os' optimization if available, else use -O2
-$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
+OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-Os,-O2)
# gcc 2.95 exits with 0 for "unrecognized option"
-$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+CFLAGS_COMBINE+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
$(if $(call cc_ge,3,0),\
$(call check_gcc,CFLAGS_COMBINE,--combine,)))
-$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+OPTIMIZATIONS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
$(call check_gcc,OPTIMIZATIONS,-funit-at-a-time,))
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25795
-#$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
+#PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_BUILD_AT_ONCE),y),\
# $(call check_gcc,PROG_CFLAGS,-fwhole-program,))
-$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,)
-#$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,)
-#$(call check_ld,LIB_LDFLAGS,--as-needed,)
-#$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,)
+LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--enable-new-dtags,)
+#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--reduce-memory-overheads,)
+#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--as-needed,)
+#LIB_LDFLAGS+=$(call check_ld,LIB_LDFLAGS,--warn-shared-textrel,)
-$(call check_ld,PROG_LDFLAGS,--gc-sections,)
+PROG_LDFLAGS+=$(call check_ld,PROG_LDFLAGS,--gc-sections,)
# Some nice architecture specific optimizations
ifeq ($(__TARGET_ARCH),arm)
OPTIMIZATIONS+=-fstrict-aliasing
endif # arm
-$(if $(call is_eq,$(__TARGET_ARCH),i386),\
+OPTIMIZATIONS+=$(if $(call is_eq,$(__TARGET_ARCH),i386),\
$(call check_gcc,OPTIMIZATIONS,-march=i386,))
# gcc-4.0 and older seem to benefit from these
-$(if $(call cc_le,4,0),\
+OPTIMIZATIONS+=$(if $(call cc_le,4,0),\
$(call check_gcc,OPTIMIZATIONS,-mpreferred-stack-boundary=2,)\
$(call check_gcc,OPTIMIZATIONS,-falign-functions=1 -falign-jumps=1 -falign-loops=1,\
-malign-functions=0 -malign-jumps=0 -malign-loops=0))
# gcc-4.1 and beyond seem to benefit from these
# turn off flags which hurt -Os
-$(if $(call cc_ge,4,1),\
+OPTIMIZATIONS+=$(if $(call cc_ge,4,1),\
$(call check_gcc,OPTIMIZATIONS,-fno-tree-loop-optimize,)\
$(call check_gcc,OPTIMIZATIONS,-fno-tree-dominator-opts,)\
$(call check_gcc,OPTIMIZATIONS,-fno-strength-reduce,)\
\
$(call check_gcc,OPTIMIZATIONS,-fno-branch-count-reg,))
-$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
+OPTIMIZATIONS+=$(call check_gcc,OPTIMIZATIONS,-fomit-frame-pointer,)
#
#--------------------------------------------------------
@@ -227,9 +237,7 @@ else
endif
endif
-$(if $(call is_eq,$(CONFIG_DEBUG),y),\
- $(call check_ld,LDFLAGS,--warn-common,),\
- $(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
+LDFLAGS+=$(if $(call is_eq,$(CONFIG_DEBUG),y),$(call check_ld,LDFLAGS,--warn-common,)$(call check_ld,LDFLAGS,--sort-common,))
ifeq ($(CONFIG_DEBUG),y)
CFLAGS +=$(WARNINGS) -g -D_GNU_SOURCE
STRIPCMD:=/bin/true -Not_stripping_since_we_are_debugging
@@ -237,14 +245,15 @@ else
CFLAGS+=$(WARNINGS) $(OPTIMIZATIONS) -D_GNU_SOURCE -DNDEBUG
STRIPCMD:=$(STRIP) -s --remove-section=.note --remove-section=.comment
endif
-$(if $(call is_eq,$(CONFIG_STATIC),y),\
+PROG_CFLAGS+=$(if $(call is_eq,$(CONFIG_STATIC),y),\
$(call check_gcc,PROG_CFLAGS,-static,))
-$(call check_gcc,CFLAGS_SHARED,-shared,)
+CFLAGS_SHARED+=$(call check_gcc,CFLAGS_SHARED,-shared,)
LIB_CFLAGS+=$(CFLAGS_SHARED)
-$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
+CFLAGS_PIC+=$(if $(call is_eq,$(CONFIG_BUILD_LIBBUSYBOX),y),\
$(call check_gcc,CFLAGS_PIC,-fPIC,))
+LIB_CFLAGS+=$(CFLAGS_PIC)
ifeq ($(CONFIG_SELINUX),y)
LIBRARIES += -lselinux
@@ -379,12 +388,11 @@ ifdef rules-mak-rules
.SUFFIXES: .c .S .o .os .om .osm .oS .so .a .s .i .E
# generic rules
-%.o: %.c ; $(compile.c)
-%.os: %.c ; $(compile.c) $(CFLAGS_PIC)
%.o: ; $(compile.c)
%.os: ; $(compile.c) $(CFLAGS_PIC)
%.om: ; $(compile.m)
%.osm: ; $(compile.m) $(CFLAGS_PIC)
+%.a: ; $(do_ar)
endif # rules-mak-rules
diff --git a/applets/Makefile.in b/applets/Makefile.in
index 64aefc017..391b4658c 100644
--- a/applets/Makefile.in
+++ b/applets/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/applets
-objdir=$(top_builddir)/applets
+srcdir:=$(top_srcdir)/applets
+objdir:=$(top_builddir)/applets
APPLETS_SRC:= $(patsubst %,$(srcdir)/%,applets.c busybox.c version.c)
@@ -14,3 +14,7 @@ APPLET_SRC-a+=$(APPLETS_SRC)
applets_OBJ:=$(patsubst $(srcdir)/%.c,$(objdir)/%.o,$(APPLETS_SRC))
+$(applets_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/applets.a: $(applets_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/applets.a
+
diff --git a/archival/Makefile.in b/archival/Makefile.in
index 6a2979e67..8a7b3bd4a 100644
--- a/archival/Makefile.in
+++ b/archival/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/archival
-objdir=$(top_builddir)/archival
+srcdir:=$(top_srcdir)/archival
+objdir:=$(top_builddir)/archival
ARCHIVAL-$(CONFIG_AR) += ar.o
ARCHIVAL-$(CONFIG_BUNZIP2) += bunzip2.o
@@ -28,3 +28,7 @@ APPLET_SRC-a+=$(ARCHIVAL_SRC-a)
archival_OBJ:= $(patsubst %,$(objdir)/%,$(ARCHIVAL-y))
+$(archival_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/archival.a: $(archival_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/archival.a
+
diff --git a/archival/libunarchive/Makefile.in b/archival/libunarchive/Makefile.in
index 75d761036..d77aff736 100644
--- a/archival/libunarchive/Makefile.in
+++ b/archival/libunarchive/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/archival/libunarchive
-objdir=$(top_builddir)/archival/libunarchive
+srcdir:=$(top_srcdir)/archival/libunarchive
+objdir:=$(top_builddir)/archival/libunarchive
LIBUNARCHIVE-y:= \
\
@@ -71,3 +71,7 @@ LIBRARY_SRC-a+=$(LIBUNARCHIVE_SRC-a)
archival_libunarchive_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBUNARCHIVE-y))
+$(archival_libunarchive_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c
+$(objdir)/libunarchive.a: $(archival_libunarchive_OBJ$(os))
+libraries-y:=$(libraries-y) $(objdir)/libunarchive.a
+
diff --git a/console-tools/Makefile.in b/console-tools/Makefile.in
index e10bc4f78..7994e0f08 100644
--- a/console-tools/Makefile.in
+++ b/console-tools/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/console-tools
-objdir=$(top_builddir)/console-tools
+srcdir:=$(top_srcdir)/console-tools
+objdir:=$(top_builddir)/console-tools
CONSOLETOOLS-$(CONFIG_CHVT) += chvt.o
CONSOLETOOLS-$(CONFIG_CLEAR) += clear.o
@@ -26,3 +26,7 @@ APPLET_SRC-a+=$(CONSOLETOOLS_SRC-a)
console-tools_OBJ:= $(patsubst %,$(objdir)/%,$(CONSOLETOOLS-y))
+$(console-tools_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/console-tools.a: $(console-tools_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/console-tools.a
+
diff --git a/coreutils/Makefile.in b/coreutils/Makefile.in
index 5f8a0ac52..73581f2aa 100644
--- a/coreutils/Makefile.in
+++ b/coreutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/coreutils
-objdir=$(top_builddir)/coreutils
+srcdir:=$(top_srcdir)/coreutils
+objdir:=$(top_builddir)/coreutils
COREUTILS-$(CONFIG_BASENAME) += basename.o
COREUTILS-$(CONFIG_CAL) += cal.o
@@ -86,3 +86,7 @@ APPLET_SRC-a+=$(COREUTILS_SRC-a)
coreutils_OBJ:= $(patsubst %,$(objdir)/%,$(COREUTILS-y))
+$(coreutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/coreutils.a: $(coreutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/coreutils.a
+
diff --git a/coreutils/libcoreutils/Makefile.in b/coreutils/libcoreutils/Makefile.in
index 700341c97..d89e9d049 100644
--- a/coreutils/libcoreutils/Makefile.in
+++ b/coreutils/libcoreutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/coreutils/libcoreutils
-objdir=$(top_builddir)/coreutils/libcoreutils
+srcdir:=$(top_srcdir)/coreutils/libcoreutils
+objdir:=$(top_builddir)/coreutils/libcoreutils
LIBCOREUTILS-$(CONFIG_MKFIFO) += getopt_mk_fifo_nod
LIBCOREUTILS-$(CONFIG_MKNOD) += getopt_mk_fifo_nod
@@ -21,3 +21,8 @@ LIBRARY_SRC-y+=$(LIBCOREUTILS_SRC-y)
LIBRARY_SRC-a+=$(LIBCOREUTILS_SRC-a)
coreutils_libcoreutils_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBCOREUTILS-y))
+
+$(coreutils_libcoreutils_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c
+$(objdir)/libcoreutils.a: $(coreutils_libcoreutils_OBJ$(os))
+libraries-y:=$(libraries-y) $(objdir)/libcoreutils.a
+
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in
index ffdb7abdc..4f72c233c 100644
--- a/debianutils/Makefile.in
+++ b/debianutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/debianutils
-objdir=$(top_builddir)/debianutils
+srcdir:=$(top_srcdir)/debianutils
+objdir:=$(top_builddir)/debianutils
DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o
DEBIANUTILS-$(CONFIG_PIPE_PROGRESS) += pipe_progress.o
@@ -21,3 +21,7 @@ APPLET_SRC-a+=$(DEBIANUTILS_SRC-a)
debianutils_OBJ:= $(patsubst %,$(objdir)/%,$(DEBIANUTILS-y))
+$(debianutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/debianutils.a: $(debianutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/debianutils.a
+
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in
index c30318b67..0ca1c976d 100644
--- a/e2fsprogs/Makefile.in
+++ b/e2fsprogs/Makefile.in
@@ -45,14 +45,7 @@ $(patsubst %,$(objdir)/%, blkid e2fsck e2p ext2fs uuid):
# may have object files created after the timestamp of the directory was
# updated which would lead to spurious rebuilds (as some of the dentries
# may be older than the dir itself).
-ifneq ($(MAKE_VERSION),3.81beta4)
-# /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/dir/file.c
-$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c |$(objdir)/blkid
-$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c|$(objdir)/e2fsck
-$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c |$(objdir)/e2p
-$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c|$(objdir)/ext2fs
-$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c |$(objdir)/uuid
-else
+ifeq ($(MAKE_VERSION),3.81beta4)
# alleged bug in 3.81beta4. Stripping dir from dir/files.c
# /top/obj/dir/*.o: /top/obj/dir/file.o: /top/src/file.c
$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/%.c |$(objdir)/blkid
@@ -60,8 +53,40 @@ $(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/%.c|$(ob
$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/%.c |$(objdir)/e2p
$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/%.c|$(objdir)/ext2fs
$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/%.c |$(objdir)/uuid
+
+e2fsprogs-rules-seen:=1
+endif
+
+ifeq ($(MAKE_VERSION),3.79.1)
+# no order-only prerequesites
+$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c #|$(objdir)/blkid
+$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c#|$(objdir)/e2fsck
+$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c #|$(objdir)/e2p
+$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c#|$(objdir)/ext2fs
+$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c #|$(objdir)/uuid
+$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid
+$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck
+$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p
+$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs
+$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid
+$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid
+$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck
+$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p
+$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs
+$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid
+
+e2fsprogs-rules-seen:=1
endif
+ifndef e2fsprogs-rules-seen
+$(patsubst %,$(objdir)/%,$(BLKID_OBJS)): $(objdir)/blkid/%.o: $(srcdir)/blkid/%.c |$(objdir)/blkid
+$(patsubst %,$(objdir)/%,$(E2FSCK_OBJS)):$(objdir)/e2fsck/%.o:$(srcdir)/e2fsck/%.c|$(objdir)/e2fsck
+$(patsubst %,$(objdir)/%,$(E2P_OBJS)): $(objdir)/e2p/%.o: $(srcdir)/e2p/%.c |$(objdir)/e2p
+$(patsubst %,$(objdir)/%,$(EXT2FS_OBJS)):$(objdir)/ext2fs/%.o:$(srcdir)/ext2fs/%.c|$(objdir)/ext2fs
+$(patsubst %,$(objdir)/%,$(UUID_OBJS)): $(objdir)/uuid/%.o: $(srcdir)/uuid/%.c |$(objdir)/uuid
+endif
+
+
E2FSPROGS-$(CONFIG_CHATTR) += chattr.o $(E2P_OBJS)
E2FSPROGS-$(CONFIG_E2FSCK) += e2fsck.o util.o $(BLKID_OBJS) $(EXT2FS_OBJS) $(UUID_OBJS)
E2FSPROGS-$(CONFIG_FSCK) += fsck.o util.o $(BLKID_OBJS) $(UUID_OBJS)
@@ -93,3 +118,7 @@ APPLETS_DEFINE-a+=$(CFLAGS-e2fsprogs) -I$(srcdir) $(E2FSPROGS_TMP_KLUDGE)
e2fsprogs_OBJ:= $(patsubst %,$(objdir)/%,$(E2FSPROGS-y))
+$(e2fsprogs_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/e2fsprogs.a: $(e2fsprogs_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/e2fsprogs.a
+
diff --git a/editors/Makefile.in b/editors/Makefile.in
index 19d8bf8e6..dd09e7a21 100644
--- a/editors/Makefile.in
+++ b/editors/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/editors
-objdir=$(top_builddir)/editors
+srcdir:=$(top_srcdir)/editors
+objdir:=$(top_builddir)/editors
EDITORS-$(CONFIG_AWK) += awk.o
EDITORS-$(CONFIG_PATCH) += patch.o
@@ -26,3 +26,7 @@ APPLET_SRC-a+=$(EDITOR_SRC-a)
editors_OBJ:= $(patsubst %,$(objdir)/%,$(EDITORS-y))
+$(editors_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/editors.a: $(editors_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/editors.a
+
diff --git a/findutils/Makefile.in b/findutils/Makefile.in
index d268f987d..7fbf8d4b9 100644
--- a/findutils/Makefile.in
+++ b/findutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/findutils
-objdir=$(top_builddir)/findutils
+srcdir:=$(top_srcdir)/findutils
+objdir:=$(top_builddir)/findutils
FINDUTILS-$(CONFIG_FIND) += find.o
FINDUTILS-$(CONFIG_GREP) += grep.o
@@ -18,3 +18,7 @@ APPLET_SRC-a+=$(FINDUTILS_SRC-a)
findutils_OBJ:= $(patsubst %,$(objdir)/%,$(FINDUTILS-y))
+$(findutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/findutils.a: $(findutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/findutils.a
+
diff --git a/init/Makefile.in b/init/Makefile.in
index a07c2189b..ef5eb1c58 100644
--- a/init/Makefile.in
+++ b/init/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/init
-objdir=$(top_builddir)/init
+srcdir:=$(top_srcdir)/init
+objdir:=$(top_builddir)/init
INIT-$(CONFIG_HALT) += halt.o
INIT-$(CONFIG_INIT) += init.o
@@ -30,3 +30,7 @@ APPLET_SRC-a+=$(INIT_SRC-a)
init_OBJ:= $(patsubst %,$(objdir)/%,$(INIT-y))
+$(init_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/init.a: $(init_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/init.a
+
diff --git a/libbb/Makefile.in b/libbb/Makefile.in
index d4cc7646a..b4ee3f501 100644
--- a/libbb/Makefile.in
+++ b/libbb/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/libbb
-objdir=$(top_builddir)/libbb
+srcdir:=$(top_srcdir)/libbb
+objdir:=$(top_builddir)/libbb
LIBBB-n:=
LIBBB-y:= \
@@ -146,3 +146,8 @@ $(LIBBB_MOBJ5:.osm=.om): $(LIBBB_MSRC5)
$(LIBBB_MOBJ6:.osm=.om): $(LIBBB_MSRC6)
endif
+$(libbb_OBJ.os): $(objdir)/%.os: $(srcdir)/%.c
+$(libbb_OBJ.o): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/libbb.a: $(libbb_OBJ$(os)) $(libbb_MOBJ$(os))
+libraries-y:=$(libraries-y) $(objdir)/libbb.a
+
diff --git a/libpwdgrp/Makefile.in b/libpwdgrp/Makefile.in
index 93c4634a2..a99d3d86f 100644
--- a/libpwdgrp/Makefile.in
+++ b/libpwdgrp/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/libpwdgrp
-objdir=$(top_builddir)/libpwdgrp
+srcdir:=$(top_srcdir)/libpwdgrp
+objdir:=$(top_builddir)/libpwdgrp
LIBPWDGRP_MSRC0:=$(srcdir)/pwd_grp.c
LIBPWDGRP_M0-$(CONFIG_USE_BB_PWD_GRP):= fgetpwent_r fgetgrent_r \
@@ -43,3 +43,7 @@ ifeq ($(om),.osm)
$(LIBPWDGRP_MOBJ0:.osm=.om): $(LIBPWDGRP_MSRC0)
$(LIBPWDGRP_MOBJ1:.osm=.om): $(LIBPWDGRP_MSRC1)
endif
+
+$(objdir)/libpwdgrp.a: $(libpwdgrp_MOBJ$(os))
+libraries-y:=$(libraries-y) $(objdir)/libpwdgrp.a
+
diff --git a/loginutils/Makefile.in b/loginutils/Makefile.in
index dfbba5019..959cb4f57 100644
--- a/loginutils/Makefile.in
+++ b/loginutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/loginutils
-objdir=$(top_builddir)/loginutils
+srcdir:=$(top_srcdir)/loginutils
+objdir:=$(top_builddir)/loginutils
LOGINUTILS-$(CONFIG_ADDGROUP) += addgroup.o
LOGINUTILS-$(CONFIG_ADDUSER) += adduser.o
@@ -36,3 +36,7 @@ endif
loginutils_OBJ:= $(patsubst %,$(objdir)/%,$(LOGINUTILS-y))
+$(loginutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/loginutils.a: $(loginutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/loginutils.a
+
diff --git a/miscutils/Makefile.in b/miscutils/Makefile.in
index 12b4f05a4..4f9de7c93 100644
--- a/miscutils/Makefile.in
+++ b/miscutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/miscutils
-objdir=$(top_builddir)/miscutils
+srcdir:=$(top_srcdir)/miscutils
+objdir:=$(top_builddir)/miscutils
MISCUTILS-$(CONFIG_ADJTIMEX) += adjtimex.o
MISCUTILS-$(CONFIG_CROND) += crond.o
@@ -40,3 +40,7 @@ APPLET_SRC-a+=$(MISCUTILS_SRC-a)
miscutils_OBJ:= $(patsubst %,$(objdir)/%,$(MISCUTILS-y))
+$(miscutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/miscutils.a: $(miscutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/miscutils.a
+
diff --git a/modutils/Makefile.in b/modutils/Makefile.in
index fc7e4ff8e..a59b29d76 100644
--- a/modutils/Makefile.in
+++ b/modutils/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/modutils
-objdir=$(top_builddir)/modutils
+srcdir:=$(top_srcdir)/modutils
+objdir:=$(top_builddir)/modutils
MODUTILS-$(CONFIG_INSMOD) += insmod.o
MODUTILS-$(CONFIG_LSMOD) += lsmod.o
@@ -19,3 +19,7 @@ APPLET_SRC-a+=$(MODUTILS_SRC-a)
modutils_OBJ:= $(patsubst %,$(objdir)/%,$(MODUTILS-y))
+$(modutils_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/modutils.a: $(modutils_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/modutils.a
+
diff --git a/networking/Makefile.in b/networking/Makefile.in
index efad05053..80cfd1733 100644
--- a/networking/Makefile.in
+++ b/networking/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/networking
-objdir=$(top_builddir)/networking
+srcdir:=$(top_srcdir)/networking
+objdir:=$(top_builddir)/networking
NETWORKING-$(CONFIG_ARPING) += arping.o
NETWORKING-$(CONFIG_DNSD) += dnsd.o
@@ -57,3 +57,7 @@ LIBRARY_DEFINE-a+= -I$(top_srcdir)/networking
networking_OBJ:= $(patsubst %,$(objdir)/%,$(NETWORKING-y))
+$(networking_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/networking.a: $(networking_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/networking.a
+
diff --git a/networking/libiproute/Makefile.in b/networking/libiproute/Makefile.in
index 99fa22e9d..2fee2796d 100644
--- a/networking/libiproute/Makefile.in
+++ b/networking/libiproute/Makefile.in
@@ -3,10 +3,9 @@
# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-#
-srcdir=$(top_srcdir)/networking/libiproute
-objdir=$(top_builddir)/networking/libiproute
+srcdir:=$(top_srcdir)/networking/libiproute
+objdir:=$(top_builddir)/networking/libiproute
LIBIPROUTE-$(CONFIG_IP) += \
ip_parse_common_args \
@@ -68,3 +67,7 @@ LIBRARY_SRC-a+=$(LIBIPROUTE_SRC-a)
networking_libiproute_OBJ$(os):=$(patsubst %,$(objdir)/%$(os),$(LIBIPROUTE-y))
+$(networking_libiproute_OBJ$(os)): $(objdir)/%$(os): $(srcdir)/%.c
+$(objdir)/networking.a: $(networking_libiproute_OBJ$(os))
+libraries-y:=$(libraries-y) $(objdir)/networking.a
+
diff --git a/networking/udhcp/Makefile.in b/networking/udhcp/Makefile.in
index ca00b647d..210939fd6 100644
--- a/networking/udhcp/Makefile.in
+++ b/networking/udhcp/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/networking/udhcp
-objdir=$(top_builddir)/networking/udhcp
+srcdir:=$(top_srcdir)/networking/udhcp
+objdir:=$(top_builddir)/networking/udhcp
#ok, so I forgot how to do an or, but this is a quick and dirty hack
ifeq ($(strip $(CONFIG_UDHCPC)),y)
@@ -88,3 +88,7 @@ endif
networking_udhcp_OBJ:=$(patsubst %.c,$(objdir)/%.o,$(UDHCP-y))
+$(networking_udhcp_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/udhcp.a: $(networking_udhcp_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/udhcp.a
+
diff --git a/procps/Makefile.in b/procps/Makefile.in
index 32314c3c5..69455eb26 100644
--- a/procps/Makefile.in
+++ b/procps/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/procps
-objdir=$(top_builddir)/procps
+srcdir:=$(top_srcdir)/procps
+objdir:=$(top_builddir)/procps
PROCPS-$(CONFIG_FREE) += free.o
PROCPS-$(CONFIG_KILL) += kill.o
@@ -25,3 +25,7 @@ APPLET_SRC-a+=$(PROCPS_SRC-a)
procps_OBJ:= $(patsubst %,$(objdir)/%,$(PROCPS-y))
+$(procps_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/procps.a: $(procps_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/procps.a
+
diff --git a/shell/Makefile.in b/shell/Makefile.in
index 43e2acd09..94cf729a7 100644
--- a/shell/Makefile.in
+++ b/shell/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/shell
-objdir=$(top_builddir)/shell
+srcdir:=$(top_srcdir)/shell
+objdir:=$(top_builddir)/shell
SHELL-$(CONFIG_ASH) += ash.o
SHELL-$(CONFIG_HUSH) += hush.o
@@ -21,3 +21,7 @@ APPLET_SRC-a+=$(SHELLT_SRC-a)
shell_OBJ:= $(patsubst %,$(objdir)/%,$(SHELL-y))
+$(shell_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/shell.a: $(shell_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/shell.a
+
diff --git a/sysklogd/Makefile.in b/sysklogd/Makefile.in
index d1f274110..412cf5bab 100644
--- a/sysklogd/Makefile.in
+++ b/sysklogd/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/sysklogd
-objdir=$(top_builddir)/sysklogd
+srcdir:=$(top_srcdir)/sysklogd
+objdir:=$(top_builddir)/sysklogd
SYSKLOGD-$(CONFIG_KLOGD) += klogd.o
SYSKLOGD-$(CONFIG_LOGGER) += logger.o
@@ -20,3 +20,7 @@ APPLET_SRC-a+=$(SYSKLOGD_SRC-a)
sysklogd_OBJ:= $(patsubst %,$(objdir)/%,$(SYSKLOGD-y))
+$(sysklogd_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/sysklogd.a: $(sysklogd_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/sysklogd.a
+
diff --git a/util-linux/Makefile.in b/util-linux/Makefile.in
index 031c798a0..b56a7766e 100644
--- a/util-linux/Makefile.in
+++ b/util-linux/Makefile.in
@@ -4,8 +4,8 @@
#
# Licensed under the GPL v2, see the file LICENSE in this tarball.
-srcdir=$(top_srcdir)/util-linux
-objdir=$(top_builddir)/util-linux
+srcdir:=$(top_srcdir)/util-linux
+objdir:=$(top_builddir)/util-linux
UTIL-LINUX-$(CONFIG_DMESG) +=dmesg.o
UTIL-LINUX-$(CONFIG_FBSET) +=fbset.o
@@ -48,3 +48,7 @@ endif
util-linux_OBJ:= $(patsubst %,$(objdir)/%,$(UTIL-LINUX-y))
+$(util-linux_OBJ): $(objdir)/%.o: $(srcdir)/%.c
+$(objdir)/util-linux.a: $(util-linux_OBJ)
+libraries-y:=$(libraries-y) $(objdir)/util-linux.a
+