Patchwork [V17,04/10] libqblock: build: add rule for libqblock.la

login
register
mail settings
Submitter Wayne Xia
Date Jan. 31, 2013, 8:53 a.m.
Message ID <1359622430-3936-5-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/217125/
State New
Headers show

Comments

Wayne Xia - Jan. 31, 2013, 8:53 a.m.
Now libqblock.la can be built with neccessary object files,
and can be automatically cleaned by make clean in root directory.
make libqblock-clean also clean it. -fvisibility=hidden was used
to hide symbols, and a special macro was introduced to export
symbols that marked as public.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 libqblock/Makefile          |   29 +++++++++++++++++++++++++++--
 1 files changed, 27 insertions(+), 2 deletions(-)
 create mode 100644 libqblock/libqblock-error.c
 create mode 100644 libqblock/libqblock.c

diff --git a/libqblock/libqblock-error.c b/libqblock/libqblock-error.c
new file mode 100644
index 0000000..e69de29
diff --git a/libqblock/libqblock.c b/libqblock/libqblock.c
new file mode 100644
index 0000000..e69de29
Stefan Hajnoczi - Jan. 31, 2013, 2:36 p.m.
On Thu, Jan 31, 2013 at 04:53:44PM +0800, Wenchao Xia wrote:
> diff --git a/libqblock/Makefile b/libqblock/Makefile
> index 8173da7..a6be721 100644
> --- a/libqblock/Makefile
> +++ b/libqblock/Makefile
> @@ -1,4 +1,29 @@
>  all: libqblock.la
>  
> -libqblock.la:
> -	@true
> +# objects linked into a shared library, built with libtool with -fPIC if required
> +libqblock-obj-y = libqblock/libqblock.o libqblock/libqblock-error.o
> +libqblock-obj-y += $(filter-out stubs/set-fd-handler.o, $(stub-obj-y))

I guess you will reimplement the function yourself later?  Please
include a comment explaining the reason for making this exception.
Wayne Xia - Feb. 1, 2013, 2:35 a.m.
于 2013-1-31 22:36, Stefan Hajnoczi 写道:
> On Thu, Jan 31, 2013 at 04:53:44PM +0800, Wenchao Xia wrote:
>> diff --git a/libqblock/Makefile b/libqblock/Makefile
>> index 8173da7..a6be721 100644
>> --- a/libqblock/Makefile
>> +++ b/libqblock/Makefile
>> @@ -1,4 +1,29 @@
>>   all: libqblock.la
>>
>> -libqblock.la:
>> -	@true
>> +# objects linked into a shared library, built with libtool with -fPIC if required
>> +libqblock-obj-y = libqblock/libqblock.o libqblock/libqblock-error.o
>> +libqblock-obj-y += $(filter-out stubs/set-fd-handler.o, $(stub-obj-y))
>
> I guess you will reimplement the function yourself later?  Please
> include a comment explaining the reason for making this exception.
>

   qemu_set_fd_handler2() in iohandler.c in block-obj-y conflict
with the symbol in stubs/set-fd-handler.c, which can be solved
in qemu-img by linking .a files, but error in linking with .lo
files, so filter it out. Yes, a comment should be added here.

Patch

diff --git a/libqblock/Makefile b/libqblock/Makefile
index 8173da7..a6be721 100644
--- a/libqblock/Makefile
+++ b/libqblock/Makefile
@@ -1,4 +1,29 @@ 
 all: libqblock.la
 
-libqblock.la:
-	@true
+# objects linked into a shared library, built with libtool with -fPIC if required
+libqblock-obj-y = libqblock/libqblock.o libqblock/libqblock-error.o
+libqblock-obj-y += $(filter-out stubs/set-fd-handler.o, $(stub-obj-y))
+libqblock-obj-y += $(util-obj-y) $(block-obj-y)
+
+libqblock-lobj-y=$(patsubst %.o, %.lo, $(libqblock-obj-y))
+
+# libtool will build the .o files, too
+$(libqblock-obj-y): | $(libqblock-lobj-y)
+
+all: libqblock.la
+
+#########################################################################
+# Rules for building libqblock standalone library
+
+libqblock.la: LDFLAGS += -rpath $(libdir) -no-undefined \
+	-export-syms $(SRC_PATH)/libqblock/libqblock.syms
+libqblock.la: $(libqblock-lobj-y)
+	$(call LINK,$^)
+
+
+.PHONY: libqblock-clean
+
+libqblock-clean:
+	rm -rf $(libqblock-lobj-y) libqblock.la libqblock/.libs
+
+clean: libqblock-clean