From 6d922a26cf713189af845b4d1470f24a95293efc Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Mon, 5 Mar 2012 17:44:11 -0500 Subject: [PATCH 44/98] guest agent: remove uneeded dependencies This patch tries to cull any uneeded library dependencies from the guest agent to improve portability across various distros. We do so by being as explicit as possible about in-tree dependencies rather than relying on existing *-obj-y targets, and by manually setting LIBS for the qemu-ga target to avoid pulling in LIBS_TOOLS libraries discovered by configure. Signed-off-by: Michael Roth Signed-off-by: Anthony Liguori (cherry picked from commit 957f1f99f263d57612807a9535f75ca4473f05f0) Conflicts: Makefile Makefile.objs configure Signed-off-by: Jeff Cody Signed-off-by: Michal Novotny --- Makefile | 10 +++++----- Makefile.objs | 13 +++++++++++++ configure | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6631c12..342a837 100644 --- a/Makefile +++ b/Makefile @@ -190,6 +190,7 @@ check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjs $(qapi-obj-y): $(GENERATED_HEADERS) qapi-dir := qapi-generated test-visitor.o test-qmp-commands.o qemu-ga$(EXESUF): QEMU_CFLAGS += -I $(qapi-dir) +qemu-ga$(EXESUF): LIBS = $(LIBS_QGA) $(qapi-dir)/test-qapi-types.c: $(qapi-dir)/test-qapi-types.h $(qapi-dir)/test-qapi-types.h: $(SRC_PATH)/qapi-schema-test.json $(SRC_PATH)/scripts/qapi-types.py @@ -216,12 +217,11 @@ test-visitor: test-visitor.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $ test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h) $(qapi-obj-y) test-qmp-commands: test-qmp-commands.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o $(qapi-obj-y) error.o osdep.o qemu-malloc.o $(oslib-obj-y) qjson.o json-streamer.o json-lexer.o json-parser.o qerror.o qemu-error.o qemu-tool.o $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o -QGALIB=qga/guest-agent-command-state.o qga/guest-agent-commands.o +QGALIB_GEN=$(addprefix $(qapi-dir)/, qga-qapi-types.c qga-qapi-types.h qga-qapi-visit.c qga-qmp-marshal.c) +$(QGALIB_GEN): $(GENERATED_HEADERS) +$(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) -qemu-ga.o: $(GENERATED_HEADERS) - -qemu-ga.o: $(addprefix $(qapi-dir)/, qga-qapi-types.c qga-qapi-types.h qga-qapi-visit.c qga-qmp-marshal.c) $(qapi-obj-y) -qemu-ga$(EXESUF): qemu-ga.o $(QGALIB) qemu-tool.o qemu-error.o error.o $(oslib-obj-y) $(trace-obj-y) $(block-obj-y) $(qobject-obj-y) $(version-obj-y) $(qapi-obj-y) qemu-sockets.o module.o qapi/qmp-dispatch.o qapi/qmp-registry.o $(qapi-dir)/qga-qapi-visit.o $(qapi-dir)/qga-qapi-types.o $(qapi-dir)/qga-qmp-marshal.o +qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(qapi-obj-y) $(trace-obj-y) $(qobject-obj-y) $(version-obj-y) $(addprefix $(qapi-dir)/, qga-qapi-visit.o qga-qapi-types.o qga-qmp-marshal.o) QEMULIBS=libhw32 libhw64 libuser diff --git a/Makefile.objs b/Makefile.objs index c9f4026..60d083b 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -192,5 +192,18 @@ qapi-nested-y = qapi-visit-core.o qmp-input-visitor.o qmp-output-visitor.o qapi- qapi-nested-y += qmp-registry.o qmp-dispatch.o qapi-obj-y = $(addprefix qapi/, $(qapi-nested-y)) +###################################################################### +# guest agent + +qga-nested-y = guest-agent-commands.o guest-agent-command-state.o +qga-obj-y = $(addprefix qga/, $(qga-nested-y)) +qga-obj-y += qemu-ga.o qemu-tool.o qemu-error.o qemu-sockets.o module.o qemu-option.o cutils.o osdep.o +qga-obj-$(CONFIG_WIN32) += qemu-malloc.o +qga-obj-$(CONFIG_POSIX) += qemu-malloc.o + +vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) + +vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS) + all: $(HWLIB) QEMU_CFLAGS+=$(GLIB_CFLAGS) diff --git a/configure b/configure index 22d2779..02cf8cf 100755 --- a/configure +++ b/configure @@ -53,6 +53,7 @@ libs_tools="" audio_pt_int="" audio_win_int="" pkg_config="pkg-config" +libs_qga="" # parse CC options first for opt do @@ -1491,6 +1492,7 @@ if $pkg_config --modversion glib-2.0 > /dev/null 2>&1 ; then glib_libs=`$pkg_config --libs glib-2.0 2>/dev/null` LIBS="$glib_libs $LIBS" LIBS="$glib_libs $LIBS" + libs_qga="$glib_libs $libs_qga" else echo "glib-2.0 required to compile QEMU" exit 1 @@ -2612,6 +2614,7 @@ echo "ARLIBS_END=$arlibs_end" >> $config_host_mak echo "LIBS+=$LIBS" >> $config_host_mak echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak echo "EXESUF=$EXESUF" >> $config_host_mak +echo "LIBS_QGA+=$libs_qga" >> $config_host_mak # generate list of library paths for linker script -- 1.7.7.6