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/misc/Makefile | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'tools/misc') diff --git a/tools/misc/Makefile b/tools/misc/Makefile index e4e8bfe14c..549ee7d3d5 100644 --- a/tools/misc/Makefile +++ b/tools/misc/Makefile @@ -15,6 +15,14 @@ TARGETS-$(CONFIG_X86) += xen-detect xen-hvmctx xen-hvmcrash TARGETS-$(CONFIG_MIGRATE) += xen-hptool TARGETS := $(TARGETS-y) +LDLIBS_xenperf := $(LDLIBS_libxenctrl) +LDLIBS_xenpm := $(LDLIBS_libxenctrl) +LDLIBS_xenlockprof := $(LDLIBS_libxenctrl) +LDLIBS_xenwatchdogd := $(LDLIBS_libxenctrl) +LDLIBS_xen-hvmctx := $(LDLIBS_libxenctrl) +LDLIBS_xen-hvmcrash := $(LDLIBS_libxenctrl) +LDLIBS_xen-hptool := $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + SUBDIRS-$(CONFIG_LOMOUNT) += lomount SUBDIRS-$(CONFIG_MINITERM) += miniterm SUBDIRS := $(SUBDIRS-y) @@ -52,7 +60,7 @@ clean: $(CC) -c $(CFLAGS) -o $@ $< xen-hvmctx xen-hvmcrash xenperf xenpm gtracestat xenlockprof xen-hptool xenwatchdogd: %: %.o Makefile - $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(LDLIBS_$*) gtraceview: %: %.o Makefile $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) $(CURSES_LIBS) -- cgit v1.2.3