From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaM5v-0006vn-7u for qemu-devel@nongnu.org; Mon, 19 Nov 2012 02:48:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaM5s-0005U1-5U for qemu-devel@nongnu.org; Mon, 19 Nov 2012 02:48:39 -0500 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:38882) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaM5r-0005Tk-7N for qemu-devel@nongnu.org; Mon, 19 Nov 2012 02:48:36 -0500 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Nov 2012 13:18:29 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qAJ7mP0O16318500 for ; Mon, 19 Nov 2012 13:18:25 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qAJDIGwQ012707 for ; Tue, 20 Nov 2012 00:18:16 +1100 Message-ID: <50A9E401.8070909@linux.vnet.ibm.com> Date: Mon, 19 Nov 2012 15:47:13 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1353060737-4244-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1353060737-4244-6-git-send-email-xiawenc@linux.vnet.ibm.com> <50A61EB5.4060105@redhat.com> <50A8DD4B.9030304@linux.vnet.ibm.com> <50A8F7AA.8060905@redhat.com> In-Reply-To: <50A8F7AA.8060905@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V9 5/8] libqblock build system List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, peter.maydell@linaro.org, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, blauwirbel@gmail.com 于 2012-11-18 22:58, Paolo Bonzini 写道: > Il 18/11/2012 14:06, Wenchao Xia ha scritto: >> 于 2012-11-16 19:08, Paolo Bonzini 写道: >>> Il 16/11/2012 11:12, 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. >>>> For testing, make check-libqblock will build binaries and execute >>>> it, make >>>> clean or make check-clean will delete generated binaries. >>>> By default this library will be built and tested, out of tree >>>> building is >>>> supported. >>>> Header files added in configure due to install-libqblock from out >>>> of tree >>>> build need these them. >>> >>> Use $(SRC_PATH) instead in the install rules. >>> >> OK. >> >>>> >>>> Signed-off-by: Wenchao Xia >>>> --- >>>> .gitignore | 2 + >>>> Makefile | 12 ++++++- >>>> configure | 4 ++- >>>> libqblock/Makefile | 72 >>>> +++++++++++++++++++++++++++++++++++++ >>>> libqblock/libqblock.pc.in | 13 +++++++ >>>> tests/Makefile | 29 ++++++++++++++- >>>> tests/libqblock/libqblock-qcow2.c | 4 ++ >>>> 7 files changed, 133 insertions(+), 3 deletions(-) >>>> create mode 100644 libqblock/Makefile >>>> create mode 100644 libqblock/libqblock-error.c >>>> create mode 100644 libqblock/libqblock-error.h >>>> create mode 100644 libqblock/libqblock-types.h >>>> create mode 100644 libqblock/libqblock.c >>>> create mode 100644 libqblock/libqblock.h >>>> create mode 100644 libqblock/libqblock.pc.in >>>> create mode 100644 tests/libqblock/libqblock-qcow2.c >>>> >>>> diff --git a/.gitignore b/.gitignore >>>> index bd6ba1c..76207fe 100644 >>>> --- a/.gitignore >>>> +++ b/.gitignore >>>> @@ -93,3 +93,5 @@ cscope.* >>>> tags >>>> TAGS >>>> *~ >>>> +tests/libqblock/check-* >>>> +tests/libqblock/test_images >>>> diff --git a/Makefile b/Makefile >>>> index 2cde430..4b0755d 100644 >>>> --- a/Makefile >>>> +++ b/Makefile >>>> @@ -189,6 +189,16 @@ 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 >>>> +libqblock.la: >>>> + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock >>>> V="$(V)" TARGET_DIR="$*/" libqblock.la,) >>>> + >>>> +install-libqblock: >>>> + $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock >>>> V="$(V)" TARGET_DIR="$*/" install-libqblock,) >>> >>> Who calls install-libqblock? >>> >> No one now, just provided an install rules similar to libcacard. > > Please call it from the install target (through a dependency). Also > remember to make these targets phony. > right, phony is important, I forgot it before. > >>>> +#library objects >>>> +libqblock-y=libqblock/libqblock.o libqblock/libqblock-error.o >>>> +tools-obj-y = $(oslib-obj-y) $(trace-obj-y) qemu-tool.o qemu-timer.o \ >>>> + qemu-timer-common.o main-loop.o notify.o \ >>>> + iohandler.o cutils.o iov.o async.o >>>> +tools-obj-$(CONFIG_POSIX) += compatfd.o >>> >>> Are all of these really needed? (In fact, after some of the recent >>> changes none of these should be needed). >>> >> OK, I'll try remove tools-objs. > > Or perhaps just trim it down. Moving it to Makefile.objs is another > idea, but please keep it as small as possible. > > OK. >>>> +tests/libqblock/%.o: QEMU_CFLAGS:= $(subst -fPIE,-fPIC, $(QEMU_CFLAGS)) >>>> +tests/libqblock/%.o: QEMU_CFLAGS:= $(subst -DPIE,-DPIC, $(QEMU_CFLAGS)) >>> >>> Why? >>> >>> A hint: if you have to do something that is not done anywhere else in >>> the tree, do not do it. >>> >> not sure whether PIE objs can be linked with dynamic library, let me >> try remove it. > > They cannot be part of a dynamic library, but they sure can be linked > with one. QEMU itself is PIE and linked with SDL, gnutls, etc. > Thanks, this extended my knowledge. >>> Also, I'm not sure we need a completely separate subdirectory for one >>> file only. You can just use >>> >>> $(check-libqblock-y): QEMU_INCLUDES += ... >>> >>> Paolo >>> >> A separate directory will allow more test cases come in easily, >> I thought to added more test cases before. > > But you have one for now... :) > OK. > Paolo > -- Best Regards Wenchao Xia