From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THAa8-0000Jn-86 for qemu-devel@nongnu.org; Thu, 27 Sep 2012 05:40:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THAa0-00006m-3P for qemu-devel@nongnu.org; Thu, 27 Sep 2012 05:40:32 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:45203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THAZz-0008U5-2k for qemu-devel@nongnu.org; Thu, 27 Sep 2012 05:40:24 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 27 Sep 2012 15:10:19 +0530 Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8R9dtWV5767510 for ; Thu, 27 Sep 2012 15:09:55 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8R9dr1X010579 for ; Thu, 27 Sep 2012 19:39:54 +1000 Message-ID: <50641EC4.9000005@linux.vnet.ibm.com> Date: Thu, 27 Sep 2012 17:39:16 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1348712642-4427-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1348712642-4427-2-git-send-email-xiawenc@linux.vnet.ibm.com> <506408F5.4080202@redhat.com> In-Reply-To: <506408F5.4080202@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH V4 1/5] libqblock build system List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , Anthony Liguori , Eric Blake , qemu-devel , Stefan Hajnoczi Ok, I'll correct them. > Il 27/09/2012 04:23, Wenchao Xia ha scritto: >> Libqblock was placed in new directory ./libqblock, libtool will build >> dynamic library there, source files of block layer remains in ./block. >> So block related source code will generate 3 sets of binary, first is old >> ones used in qemu, second and third are non PIC and PIC ones in ./libqblock. >> GCC compiler flag visibility=hidden was used with special macro, to export >> only symbols that was marked as PUBLIC. >> >> Signed-off-by: Wenchao Xia >> --- >> Makefile | 14 +++++++++- >> Makefile.objs | 6 ++++ >> libqblock/Makefile | 56 +++++++++++++++++++++++++++++++++++++++++++ >> 3 files changed, 74 insertions(+), 2 deletions(-) >> create mode 100644 libqblock/Makefile >> create mode 100644 libqblock/libqblock-error.c >> create mode 100644 libqblock/libqblock.c >> >> diff --git a/Makefile b/Makefile >> index def2ae2..128bc6a 100644 >> --- a/Makefile >> +++ b/Makefile >> @@ -164,6 +164,17 @@ qemu-io$(EXESUF): qemu-io.o cmd.o $(tools-obj-y) $(block-obj-y) >> >> qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o >> >> +###################################################################### >> +# Support building shared library libqblock >> +ifeq ($(LIBTOOL),) >> +$(libqblock-lib-la): >> + @echo "libtool is missing, please install and rerun configure"; exit 1 >> +else >> +$(libqblock-lib-la): >> + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock V="$(V)" TARGET_DIR="$*/" $(libqblock-lib-la),) >> +endif > > Please remove the useless indirection via $(libqblock-lib-la). In general, > this patch should be redone more similar to how libcacard is build: > > subdir-libcacard: $(oslib-obj-y) $(trace-obj-y) qemu-timer-common.o > ... > libcacard.la: $(oslib-obj-y) qemu-timer-common.o $(trace-obj-y) > $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,) > > install-libcacard: libcacard.la > $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,) > > > (The ifeq is not necessary, I'm going to remove it from libcacard too. The > same error message is already raised in libcacard/Makefile). > >> +########################################################################### >> + >> vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) $(trace-obj-y) $(tools-obj-y) qemu-timer-common.o libcacard/vscclient.o >> $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@") >> >> @@ -226,8 +237,7 @@ clean: >> rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp) >> rm -rf qapi-generated >> rm -rf qga/qapi-generated >> - $(MAKE) -C tests/tcg clean >> - for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ >> + for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard libqblock; do \ >> if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ >> rm -f $$d/qemu-options.def; \ >> done >> diff --git a/Makefile.objs b/Makefile.objs >> index 4412757..8a4c9fc 100644 >> --- a/Makefile.objs >> +++ b/Makefile.objs >> @@ -248,3 +248,9 @@ nested-vars += \ >> common-obj-y \ >> extra-obj-y >> dummy := $(call unnest-vars) >> + >> +############################################################################# >> +# libqblock >> + >> +libqblock-lib-la = libqblock.la >> +libqblock-lib-path = libqblock > > Remove these two please. > >> diff --git a/libqblock/Makefile b/libqblock/Makefile >> new file mode 100644 >> index 0000000..5f65613 >> --- /dev/null >> +++ b/libqblock/Makefile >> @@ -0,0 +1,56 @@ >> +########################################################################### >> +# libqblock Makefile >> +# Todo: >> +# 1 trace related files is generated in this directory, move >> +# them to the root directory. >> +########################################################################## >> +-include ../config-host.mak >> +-include $(SRC_PATH)/Makefile.objs >> +-include $(SRC_PATH)/rules.mak >> + >> +############################################################################# >> +# Library settings >> +############################################################################# >> +$(call set-vpath, $(SRC_PATH)) >> + >> +#expand the foldered vars,especially ./block >> +dummy := $(call unnest-vars-1) > > Please use unnest-vars. > >> +#library objects >> +libqblock-y=libqblock.o libqblock-error.o >> + >> +QEMU_OBJS= $(libqblock-y) $(block-obj-y) >> +#filter out ./block >> +QEMU_OBJS_FILTERED=$(filter %.o, $(QEMU_OBJS)) >> +QEMU_OBJS_LIB=$(patsubst %.o, %.lo, $(QEMU_OBJS_FILTERED)) >> + >> +QEMU_CFLAGS+= -I../ -I../include >> +#adding magic macro define for symbol hiding and exposing >> +QEMU_CFLAGS+= -fvisibility=hidden -D LIBQB_BUILD >> + >> +#dependency libraries >> +LIBS+=-lz $(LIBS_TOOLS) >> + >> +################################################################# >> +# Runtime rules >> +################################################################# >> +clean: >> + rm -f *.lo *.o *.d *.la libqblock-test trace.c trace.c-timestamp >> + rm -rf .libs block trace >> + >> +help: >> + @echo type make libqblock-test at root dirtory, libtool is required > > Please remove this rule. > >> +#make directory ./block at runtime which would hold the output of block/*.c >> +block: >> + @mkdir block >> + >> +ifeq ($(LIBTOOL),) >> +$(libqblock-lib-la): >> + @echo "libtool is missing, please install and rerun configure"; exit 1 >> +else >> +$(libqblock-lib-la): $(QEMU_OBJS_LIB) >> + $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(LIBS)," lt LINK $@") >> +endif >> + >> +.PHONY: libqblock.la > -- Best Regards Wenchao Xia