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

login
register
mail settings
Submitter Wayne Xia
Date Jan. 23, 2013, 11:18 a.m.
Message ID <1358939887-22533-5-git-send-email-xiawenc@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/214910/
State New
Headers show

Comments

Wayne Xia - Jan. 23, 2013, 11:18 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>
---
 Makefile.objs               |    7 +++++++
 libqblock/Makefile          |   31 +++++++++++++++++++++++++++++--
 2 files changed, 36 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
Wayne Xia - Jan. 24, 2013, 1:54 a.m.
于 2013-1-23 19:24, Paolo Bonzini 写道:
> Il 23/01/2013 12:18, Wenchao Xia ha scritto:
>>    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>
>> ---
>>   Makefile.objs               |    7 +++++++
>>   libqblock/Makefile          |   31 +++++++++++++++++++++++++++++--
>>   2 files changed, 36 insertions(+), 2 deletions(-)
>>   create mode 100644 libqblock/libqblock-error.c
>>   create mode 100644 libqblock/libqblock.c
>>
>> diff --git a/Makefile.objs b/Makefile.objs
>> index d465a72..ab2712d 100644
>> --- a/Makefile.objs
>> +++ b/Makefile.objs
>> @@ -89,6 +89,13 @@ libcacard-y += libcacard/card_7816.o
>>   common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
>>
>>   ######################################################################
>> +# libqblock
>> +
>> +libqblock-y += libqblock/libqblock.o libqblock/libqblock-error.o
>> +
>> +common-obj-$(CONFIG_LIBQBLOCK) += $(libqblock-y)
>
> This is not needed.
>
> Just include the libqblock/ files into libqblock/Makefile.
>
> Otherwise seems okay.
>
> Paolo
>

   OK.

>> +######################################################################
>>   # qapi
>>
>>   common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o
>> diff --git a/libqblock/Makefile b/libqblock/Makefile
>> index 734d90e..cdbfffb 100644
>> --- a/libqblock/Makefile
>> +++ b/libqblock/Makefile
>> @@ -1,4 +1,31 @@
>>   TOOLS += libqblock.la
>>
>> -libqblock.la:
>> -	@true
>> +# objects linked into a shared library, built with libtool with -fPIC if required
>> +libqblock-obj-y = $(libqblock-y) $(util-obj-y)
>> +libqblock-obj-y += $(filter-out stubs/set-fd-handler.o, $(stub-obj-y))
>> +libqblock-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)
>> +
>> +LIBQBLOCK_CLEAN_TARGETS=$(libqblock-lobj-y) libqblock.la libqblock/.libs
>> +SUBDIR_CLEAN_RULES+=libqblock-clean
>> +
>> +all: libqblock.la
>> +
>> +#########################################################################
>> +# Rules for building libqblock standalone library
>> +
>> +$(libqblock-lobj-y): QEMU_CFLAGS+= -fvisibility=hidden -D LIBQB_BUILD
>> +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 $(LIBQBLOCK_CLEAN_TARGETS) -rf
>> 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
>>
>

Patch

diff --git a/Makefile.objs b/Makefile.objs
index d465a72..ab2712d 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -89,6 +89,13 @@  libcacard-y += libcacard/card_7816.o
 common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y)
 
 ######################################################################
+# libqblock
+
+libqblock-y += libqblock/libqblock.o libqblock/libqblock-error.o
+
+common-obj-$(CONFIG_LIBQBLOCK) += $(libqblock-y)
+
+######################################################################
 # qapi
 
 common-obj-y += qmp-marshal.o qapi-visit.o qapi-types.o
diff --git a/libqblock/Makefile b/libqblock/Makefile
index 734d90e..cdbfffb 100644
--- a/libqblock/Makefile
+++ b/libqblock/Makefile
@@ -1,4 +1,31 @@ 
 TOOLS += libqblock.la
 
-libqblock.la:
-	@true
+# objects linked into a shared library, built with libtool with -fPIC if required
+libqblock-obj-y = $(libqblock-y) $(util-obj-y)
+libqblock-obj-y += $(filter-out stubs/set-fd-handler.o, $(stub-obj-y))
+libqblock-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)
+
+LIBQBLOCK_CLEAN_TARGETS=$(libqblock-lobj-y) libqblock.la libqblock/.libs
+SUBDIR_CLEAN_RULES+=libqblock-clean
+
+all: libqblock.la
+
+#########################################################################
+# Rules for building libqblock standalone library
+
+$(libqblock-lobj-y): QEMU_CFLAGS+= -fvisibility=hidden -D LIBQB_BUILD
+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 $(LIBQBLOCK_CLEAN_TARGETS) -rf