Skip to contentSkip to conversation

libqblock, build system

RFC PATCH In review Wenchao Xia 1 participant 1 message Aug 29, 2012 Kbuild

lore
Share & tools
lore
#0 lore raw

RFC PATCH v3 5/5 libqblock, build system

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 on PIC and PIC ones in ./libqblock.

---
 Makefile           |   23 +++++++++++++++-
 libqblock/Makefile |   74 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 96 insertions(+), 1 deletions(-)
 create mode 100644 libqblock/Makefile
Makefile +22 -1
index 621cb86..942ec49 100644
@@ -169,6 +169,27 @@ qemu-bridge-helper$(EXESUF): qemu-bridge-helper.o
 fsdev/virtfs-proxy-helper$(EXESUF): fsdev/virtfs-proxy-helper.o fsdev/virtio-9p-marshal.o oslib-posix.o $(trace-obj-y)
 fsdev/virtfs-proxy-helper$(EXESUF): LIBS += -lcap
 
+######################################################################
+# Support building shared library libqblock
+
+.PHONY: libqblock.la
+ifeq ($(LIBTOOL),)
+libqblock.la:
+	@echo "libtool is missing, please install and rerun configure"; exit 1
+else
+libqblock.la:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock V="$(V)" TARGET_DIR="$*/" libqblock.la,)
+libqblock-test:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock V="$(V)" TARGET_DIR="$*/" libqblock-test,)
+libqblock-test-static:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock V="$(V)" TARGET_DIR="$*/" libqblock-test-static,)
+endif
+
+#make native test file instead of libtool
+libqblock-test-native$(EXESUF): libqblock/libqblock.o libqblock/libqblock-test.o $(tools-obj-y) $(block-obj-y)
+	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(LIBS),"  LINK  $@")
+
+########################################################################
 qemu-img-cmds.h: $(SRC_PATH)/qemu-img-cmds.hx
 	$(call quiet-command,sh $(SRC_PATH)/scripts/hxtool -h < $< > $@,"  GEN   $@")
 
@@ -227,7 +248,7 @@ clean:
 	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
libqblock/Makefile new file +74 -0

74 lines not on this page · raw message

Signature · 1 line
1.7.1