Fix e2initrd_helper, blkid, and fsck from linking with unneeded libraries

... especially when using ELF shared libraries.  We only need to link
with a library if the executable uses that library directly.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o 2008-09-04 22:36:52 -04:00
parent 61e6e045e2
commit 29551cacca
3 changed files with 16 additions and 17 deletions

View File

@ -75,11 +75,11 @@ LIBCOM_ERR = $(LIB)/libcom_err@LIB_EXT@
LIBE2P = $(LIB)/libe2p@LIB_EXT@
LIBEXT2FS = $(LIB)/libext2fs@LIB_EXT@
LIBUUID = $(LIB)/libuuid@LIB_EXT@ @SOCKET_LIB@
LIBBLKID = $(LIB)/libblkid@LIB_EXT@
LIBBLKID = $(LIB)/libblkid@LIB_EXT@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
LIBINTL = @LIBINTL@
DEPLIBSS = $(LIB)/libss@LIB_EXT@
DEPLIBUUID = $(LIB)/libuuid@LIB_EXT@
DEPLIBBLKID = $(LIB)/libblkid@LIB_EXT@
DEPLIBBLKID = $(LIB)/libblkid@LIB_EXT@ @PRIVATE_LIBS_CMT@ $(LIBUUID)
STATIC_LIBSS = $(LIB)/libss@STATIC_LIB_EXT@ @DLOPEN_LIB@
STATIC_LIBCOM_ERR = $(LIB)/libcom_err@STATIC_LIB_EXT@

View File

@ -61,9 +61,6 @@ DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR)
STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR)
LIBS_BLKID= $(LIBBLKID) $(LIBUUID) $(LIBEXT2FS)
DEPLIBS_BLKID= $(DEPLIBBLKID) $(DEPLIBUUID) $(LIBEXT2FS)
LIBS_E2P= $(LIBE2P) $(LIBCOM_ERR)
DEPLIBS_E2P= $(LIBE2P) $(LIBCOM_ERR)
@ -96,15 +93,16 @@ partinfo: partinfo.o
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o partinfo partinfo.o
e2initrd_helper: e2initrd_helper.o $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBS_BLKID)
e2initrd_helper: e2initrd_helper.o $(DEPLIBS) $(DEPLIBBLKID) $(LIBEXT2FS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o e2initrd_helper e2initrd_helper.o $(LIBS) \
$(LIBS_BLKID) $(LIBS_E2P) $(LIBINTL)
$(LIBBLKID) $(LIBEXT2FS) $(LIBINTL)
tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBS_BLKID)
tune2fs: $(TUNE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBBLKID) \
$(DEPLIBUUID) $(LIBEXT2FS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o tune2fs $(TUNE2FS_OBJS) $(LIBS) \
$(LIBS_BLKID) $(LIBS_E2P) $(LIBINTL)
$(LIBBLKID) $(LIBUUID) $(LIBEXT2FS) $(LIBS_E2P) $(LIBINTL)
tune2fs.static: $(TUNE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBBLKID)
@echo " LD $@"
@ -112,9 +110,10 @@ tune2fs.static: $(TUNE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_L
$(STATIC_LIBS) $(STATIC_LIBBLKID) $(STATIC_LIBUUID) \
$(STATIC_LIBE2P) $(LIBINTL)
blkid: $(BLKID_OBJS) $(DEPLIBS_BLKID)
blkid: $(BLKID_OBJS) $(DEPLIBBLKID) $(LIBEXT2FS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o blkid $(BLKID_OBJS) $(LIBS_BLKID) $(LIBINTL)
@$(CC) $(ALL_LDFLAGS) -o blkid $(BLKID_OBJS) $(LIBBLKID) $(LIBINTL) \
$(LIBEXT2FS)
e2image: $(E2IMAGE_OBJS) $(DEPLIBS)
@echo " LD $@"
@ -137,10 +136,11 @@ mklost+found: $(MKLPF_OBJS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o mklost+found $(MKLPF_OBJS) $(LIBINTL)
mke2fs: $(MKE2FS_OBJS) $(DEPLIBS) $(LIBE2P) $(DEPLIBUUID) $(DEPLIBS_BLKID)
mke2fs: $(MKE2FS_OBJS) $(DEPLIBS) $(LIBE2P) $(DEPLIBBLKID) $(DEPLIBUUID) \
$(LIBEXT2FS)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS) $(LIBS_BLKID) \
$(LIBE2P) $(LIBUUID) $(LIBINTL)
@$(CC) $(ALL_LDFLAGS) -o mke2fs $(MKE2FS_OBJS) $(LIBS) $(LIBBLKID) \
$(LIBUUID) $(LIBEXT2FS) $(LIBE2P) $(LIBINTL)
mke2fs.static: $(MKE2FS_OBJS) $(STATIC_DEPLIBS) $(STATIC_LIBE2P) $(DEPSTATIC_LIBUUID) $(DEPSTATIC_LIBBLKID)
@echo " LD $@"
@ -169,9 +169,9 @@ dumpe2fs: $(DUMPE2FS_OBJS) $(DEPLIBS) $(DEPLIBS_E2P) $(DEPLIBUUID)
@$(CC) $(ALL_LDFLAGS) -o dumpe2fs $(DUMPE2FS_OBJS) $(LIBS) \
$(LIBS_E2P) $(LIBUUID) $(LIBINTL)
fsck: $(FSCK_OBJS) $(DEBLIBS_BLKID)
fsck: $(FSCK_OBJS) $(DEPLIBBLKID)
@echo " LD $@"
@$(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBS_BLKID) $(LIBINTL)
@$(CC) $(ALL_LDFLAGS) -o fsck $(FSCK_OBJS) $(LIBBLKID) $(LIBINTL)
badblocks: $(BADBLOCKS_OBJS) $(DEPLIBS)
@echo " LD $@"

View File

@ -33,7 +33,6 @@ extern char *optarg;
#include "ext2fs/ext2_fs.h"
#include "ext2fs/ext2fs.h"
#include "e2p/e2p.h"
#include "blkid/blkid.h"
#include "../version.h"