From 494c9074b3dc32b7b3b7f84e6aca2781f9bdc096 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Thu, 17 Mar 2011 19:38:05 +0000 Subject: tools: do not link against unused libraries. A fair few things under tools link against libraries which they don't even use. Most of this appears to come from copy-and-pasting previous Makefile snippets and cargo-culting plus the tendency to define global $(LIBS) even for Makefiles which build multiple separate utilities or libraries. Identified by comparing a build with --as-needed to one without by looking at the NEEDED header of all ELF objects. Signed-off-by: Ian Campbell Acked-by: Ian Jackson Committed-by: Ian Jackson --- tools/blktap2/drivers/Makefile | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'tools/blktap2') diff --git a/tools/blktap2/drivers/Makefile b/tools/blktap2/drivers/Makefile index 33a33d3606..54b2a64328 100644 --- a/tools/blktap2/drivers/Makefile +++ b/tools/blktap2/drivers/Makefile @@ -23,11 +23,7 @@ ifeq ($(CONFIG_X86_64),y) CFLAGS += -fPIC endif -LIBS += -lrt -lz - -LBLIBS_img := $(LDLIBS_libxenctrl) $(CRYPT_LIB) -lpthread -lz -lm - -LIBS += -L$(LIBVHDDIR) -lvhd +VHDLIBS := -L$(LIBVHDDIR) -lvhd REMUS-OBJS := block-remus.o REMUS-OBJS += hashtable.o @@ -88,26 +84,26 @@ BLK-OBJS-y += $(REMUS-OBJS) all: $(IBIN) lock-util qcow-util -tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.c - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img) +tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.o + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm tapdisk-client: tapdisk-client.o - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LBLIBS_img) + $(CC) -o $@ $^ $(LDFLAGS) -lrt tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img) + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(LBLIBS_img) + $(CC) -o $@ $^ $(LDFLAGS) $(VHDLIBS) lock-util: lock.c - $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(LIBS) + $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) .PHONY: qcow-util qcow-util: img2qcow qcow2raw qcow-create img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y) - $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS) $(AIOLIBS) $(MEMSHRLIBS) $(LBLIBS_img) + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm install: all $(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR) -- cgit v1.2.3