build system: small optimization
diff --git a/e2fsprogs/Kbuild b/e2fsprogs/Kbuild
index f35a1ae..edd0d5e 100644
--- a/e2fsprogs/Kbuild
+++ b/e2fsprogs/Kbuild
@@ -7,21 +7,10 @@
 lib-y:=
 
 lib-$(CONFIG_CHATTR)     += chattr.o
-libs-$(CONFIG_CHATTR)    += e2p/
-
 lib-$(CONFIG_E2FSCK)     += e2fsck.o util.o
-libs-$(CONFIG_E2FSCK)    += blkid/ ext2fs/ uuid/
-
 lib-$(CONFIG_FSCK)       += fsck.o util.o
-libs-$(CONFIG_FSCK)      += blkid/ ext2fs/ uuid/
-
 lib-$(CONFIG_LSATTR)     += lsattr.o
-libs-$(CONFIG_LSATTR)    += e2p/
-
 lib-$(CONFIG_MKE2FS)     += mke2fs.o util.o
-libs-$(CONFIG_MKE2FS)    += e2p/ blkid/ ext2fs/ uuid/
-
 lib-$(CONFIG_TUNE2FS)    += tune2fs.o util.o
-libs-$(CONFIG_TUNE2FS)   += e2p/ blkid/ ext2fs/ uuid/
 
 CFLAGS += -include e2fsprogs/e2fsbb.h
diff --git a/e2fsprogs/blkid/Kbuild b/e2fsprogs/blkid/Kbuild
index ba0bee0..98b5c27 100644
--- a/e2fsprogs/blkid/Kbuild
+++ b/e2fsprogs/blkid/Kbuild
@@ -4,9 +4,14 @@
 #
 # Licensed under the GPL v2, see the file LICENSE in this tarball.
 
+NEEDED-$(CONFIG_E2FSCK) = y
+NEEDED-$(CONFIG_FSCK) = y
+NEEDED-$(CONFIG_MKE2FS) = y
+NEEDED-$(CONFIG_TUNE2FS) = y
+
 lib-y:=
-lib-y	+= cache.o dev.o devname.o devno.o blkid_getsize.o \
-	   probe.o read.o resolve.o save.o tag.o list.o
+lib-$(NEEDED-y) += cache.o dev.o devname.o devno.o blkid_getsize.o \
+                   probe.o read.o resolve.o save.o tag.o list.o
 
 CFLAGS_dev.o := -include include/busybox.h
 CFLAGS_devname.o := -include include/busybox.h
diff --git a/e2fsprogs/e2p/Kbuild b/e2fsprogs/e2p/Kbuild
index 24a692e..64e4621 100644
--- a/e2fsprogs/e2p/Kbuild
+++ b/e2fsprogs/e2p/Kbuild
@@ -4,7 +4,12 @@
 #
 # Licensed under the GPL v2, see the file LICENSE in this tarball.
 
+NEEDED-$(CONFIG_CHATTR) = y
+NEEDED-$(LSATTR) = y
+NEEDED-$(MKE2FS) = y
+NEEDED-$(TUNE2FS) = y
+
 lib-y:=
-lib-y	+= fgetsetflags.o fgetsetversion.o pf.o iod.o mntopts.o \
+lib-$(NEEDED-y) += fgetsetflags.o fgetsetversion.o pf.o iod.o mntopts.o \
            feature.o ls.o uuid.o pe.o ostype.o ps.o hashstr.o \
            parse_num.o
diff --git a/e2fsprogs/ext2fs/Kbuild b/e2fsprogs/ext2fs/Kbuild
index dc49934..d7d6f9a 100644
--- a/e2fsprogs/ext2fs/Kbuild
+++ b/e2fsprogs/ext2fs/Kbuild
@@ -4,15 +4,20 @@
 #
 # Licensed under the GPL v2, see the file LICENSE in this tarball.
 
+NEEDED-$(CONFIG_E2FSCK) = y
+NEEDED-$(CONFIG_FSCK) = y
+NEEDED-$(CONFIG_MKE2FS) = y
+NEEDED-$(CONFIG_TUNE2FS) = y
+
 lib-y:=
-lib-y	+= gen_bitmap.o bitops.o ismounted.o mkjournal.o unix_io.o \
-	   rw_bitmaps.o initialize.o bitmaps.o block.o \
-	   ind_block.o inode.o freefs.o alloc_stats.o closefs.o \
-	   openfs.o io_manager.o finddev.o read_bb.o alloc.o badblocks.o \
-	   getsize.o getsectsize.o alloc_tables.o read_bb_file.o mkdir.o \
-	   bb_inode.o newdir.o alloc_sb.o lookup.o dirblock.o expanddir.o \
-	   dir_iterate.o link.o res_gdt.o icount.o get_pathname.o dblist.o \
-	   dirhash.o version.o flushb.o unlink.o check_desc.o valid_blk.o \
-	   ext_attr.o bmap.o dblist_dir.o ext2fs_inline.o swapfs.o
+lib-$(NEEDED-y) += gen_bitmap.o bitops.o ismounted.o mkjournal.o unix_io.o \
+                   rw_bitmaps.o initialize.o bitmaps.o block.o \
+                   ind_block.o inode.o freefs.o alloc_stats.o closefs.o \
+                   openfs.o io_manager.o finddev.o read_bb.o alloc.o badblocks.o \
+                   getsize.o getsectsize.o alloc_tables.o read_bb_file.o mkdir.o \
+                   bb_inode.o newdir.o alloc_sb.o lookup.o dirblock.o expanddir.o \
+                   dir_iterate.o link.o res_gdt.o icount.o get_pathname.o dblist.o \
+                   dirhash.o version.o flushb.o unlink.o check_desc.o valid_blk.o \
+                   ext_attr.o bmap.o dblist_dir.o ext2fs_inline.o swapfs.o
 
 CFLAGS += -include e2fsprogs/e2fsbb.h
diff --git a/e2fsprogs/uuid/Kbuild b/e2fsprogs/uuid/Kbuild
index 0ae74ae..dde9818 100644
--- a/e2fsprogs/uuid/Kbuild
+++ b/e2fsprogs/uuid/Kbuild
@@ -4,6 +4,11 @@
 #
 # Licensed under the GPL v2, see the file LICENSE in this tarball.
 
+NEEDED-$(CONFIG_E2FSCK) = y
+NEEDED-$(CONFIG_FSCK) = y
+NEEDED-$(CONFIG_MKE2FS) = y
+NEEDED-$(CONFIG_TUNE2FS) = y
+
 lib-y:=
-lib-y	+= compare.o gen_uuid.o pack.o parse.o unpack.o unparse.o \
-	   uuid_time.o
+lib-$(NEEDED-y) += compare.o gen_uuid.o pack.o parse.o unpack.o unparse.o \
+                   uuid_time.o