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 <xiaw...@linux.vnet.ibm.com>
---
 libqblock/Makefile          |   32 ++++++++++++++++++++++++++++++--
 1 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 libqblock/libqblock-error.c
 create mode 100644 libqblock/libqblock.c

diff --git a/libqblock/Makefile b/libqblock/Makefile
index 8173da7..73974e9 100644
--- a/libqblock/Makefile
+++ b/libqblock/Makefile
@@ -1,4 +1,32 @@
 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)
+
+LIBQBLOCK_CLEAN_TARGETS=$(libqblock-lobj-y) libqblock.la libqblock/.libs
+
+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
+
+clean: libqblock-clean
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
-- 
1.7.1



Reply via email to