From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
pbonzini@redhat.com, eblake@redhat.com,
Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH 6/6] libqblock building system
Date: Mon, 3 Sep 2012 17:18:46 +0800 [thread overview]
Message-ID: <1346663926-20188-7-git-send-email-xiawenc@linux.vnet.ibm.com> (raw)
In-Reply-To: <1346663926-20188-1-git-send-email-xiawenc@linux.vnet.ibm.com>
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.
Test cases are placed under tests/libqblock/.
Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
Makefile | 22 +++++++++++++++-
Makefile.objs | 6 ++++
libqblock/Makefile | 62 ++++++++++++++++++++++++++++++++++++++++++++++
tests/Makefile | 3 ++
tests/libqblock/Makefile | 28 ++++++++++++++++++++
5 files changed, 120 insertions(+), 1 deletions(-)
create mode 100644 libqblock/Makefile
create mode 100644 tests/libqblock/Makefile
diff --git a/Makefile b/Makefile
index 1cd5bc8..9f3c0a0 100644
--- a/Makefile
+++ b/Makefile
@@ -163,6 +163,25 @@ 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
+
+.PHONY: libqblock.la
+ifeq ($(LIBTOOL),)
+$(libqblock-lib-la):
+ @echo "libtool is missing, please install and rerun configure"; exit 1
+else
+$(libqblock-lib-la):
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libqblock V="$(V)" TARGET_DIR="$*/" $(libqblock-lib-la),)
+endif
+
+#make native test file instead of libtool, as a test for development
+QEMU_CFLAGS+=-I./libqblock
+libqblock-objs=libqblock/libqblock.o libqblock/libqblock-helper.o libqblock/libqblock-error.o
+libqblock-test-native$(EXESUF): $(libqblock-objs) tests/libqblock/libqblock-test.o $(tools-obj-y) $(block-obj-y)
+ $(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)," LINK $@")
+###########################################################################
+
vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) $(trace-obj-y) $(tools-obj-y) qemu-timer-common.o libcacard/vscclient.o
$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@")
@@ -226,7 +245,8 @@ clean:
rm -rf qapi-generated
rm -rf qga/qapi-generated
$(MAKE) -C tests/tcg clean
- for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \
+ $(MAKE) -C tests/libqblock clean
+ 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
diff --git a/Makefile.objs b/Makefile.objs
index 4412757..8a4c9fc 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -248,3 +248,9 @@ nested-vars += \
common-obj-y \
extra-obj-y
dummy := $(call unnest-vars)
+
+#############################################################################
+# libqblock
+
+libqblock-lib-la = libqblock.la
+libqblock-lib-path = libqblock
diff --git a/libqblock/Makefile b/libqblock/Makefile
new file mode 100644
index 0000000..5f16000
--- /dev/null
+++ b/libqblock/Makefile
@@ -0,0 +1,62 @@
+###########################################################################
+# libqblock Makefile
+# Todo:
+# 1 trace related files is generated in this directory, move
+# them to the root directory.
+##########################################################################
+-include ../config-host.mak
+-include $(SRC_PATH)/Makefile.objs
+-include $(SRC_PATH)/rules.mak
+
+#############################################################################
+# Library settings
+#############################################################################
+$(call set-vpath, $(SRC_PATH))
+
+#expand the foldered vars,especially ./block
+dummy := $(call unnest-vars-1)
+
+#library objects
+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
+
+libqblock-y=libqblock.o libqblock-helper.o libqblock-error.o
+libqblock-lib-y=$(patsubst %.o,%.lo,$(libqblock-y))
+
+QEMU_OBJS=$(tools-obj-y) $(block-obj-y)
+QEMU_OBJS_FILTERED=$(filter %.o,$(QEMU_OBJS))
+QEMU_OBJS_LIB=$(patsubst %.o, %.lo,$(QEMU_OBJS_FILTERED))
+
+QEMU_CFLAGS+=-I../ -I../include
+
+#dependency libraries
+LIBS+=-lz $(LIBS_TOOLS)
+
+#################################################################
+# Runtime rules
+#################################################################
+clean:
+ rm -f *.lo *.o *.d *.la libqblock-test trace.c trace.c-timestamp
+ rm -rf .libs block trace
+
+all: libqblock-test
+ @true
+
+help:
+ @echo type make libqblock-test at root dirtory, libtool is required
+
+#make dir block at runtime which would hold the output of block/*.c
+block:
+ @mkdir block
+
+ifeq ($(LIBTOOL),)
+$(libqblock-lib-la):
+ @echo "libtool is missing, please install and rerun configure"; exit 1
+else
+$(libqblock-lib-la): $(libqblock-lib-y) $(QEMU_OBJS_LIB)
+ $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(LIBS)," lt LINK $@")
+endif
+
+.PHONY: libqblock.la
diff --git a/tests/Makefile b/tests/Makefile
index 26a67ce..69af1e2 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -148,4 +148,7 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
check-block: $(patsubst %,check-%, $(check-block-y))
check: check-unit check-qtest
+check-libqblock:
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/libqblock V="$(V)" TARGET_DIR="$*/" check-libqblock,)
+
-include $(wildcard tests/*.d)
diff --git a/tests/libqblock/Makefile b/tests/libqblock/Makefile
new file mode 100644
index 0000000..4b4da2f
--- /dev/null
+++ b/tests/libqblock/Makefile
@@ -0,0 +1,28 @@
+-include ../../config-host.mak
+-include $(SRC_PATH)/Makefile.objs
+-include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH))
+
+#library test case objects
+libqblock-test-objs=libqblock-test.lo
+
+QEMU_CFLAGS+=-I $(SRC_PATH)/$(libqblock-lib-path)
+libqblock-la-path = $(SRC_PATH)/$(libqblock-lib-path)/$(libqblock-lib-la)
+
+##########################################################################
+#runtime rules:
+ifeq ($(LIBTOOL),)
+libqblock-test.bin:
+ @echo "libtool is missing, please install and rerun configure"; exit 1
+else
+libqblock-test.bin: $(libqblock-test-objs)
+ $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -shared -rpath $(libdir) -o $@ $^ $(libqblock-la-path)," lt LINK $@")
+endif
+
+check-libqblock: libqblock-test.bin
+ ./libqblock-test.bin
+
+clean:
+ rm -f *.lo *.o *.d *.la *.bin
+ rm -rf .libs
--
1.7.1
next prev parent reply other threads:[~2012-09-03 9:22 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-03 9:18 [Qemu-devel] [PATCH 0/6] libqblock, qemu block layer library Wenchao Xia
2012-09-03 9:18 ` [Qemu-devel] [PATCH 1/6] libqblock APIs Wenchao Xia
2012-09-03 13:18 ` Paolo Bonzini
2012-09-04 3:15 ` Wenchao Xia
2012-09-04 6:50 ` Paolo Bonzini
2012-09-04 9:05 ` Wenchao Xia
2012-09-10 8:10 ` Wenchao Xia
2012-09-03 13:56 ` Eric Blake
2012-09-03 14:05 ` Paolo Bonzini
2012-09-04 7:05 ` Wenchao Xia
2012-09-04 7:29 ` Paolo Bonzini
2012-09-04 6:42 ` Wenchao Xia
2012-09-04 11:35 ` Eric Blake
2012-09-04 13:47 ` Paolo Bonzini
2012-09-03 19:22 ` Blue Swirl
2012-09-03 9:18 ` [Qemu-devel] [PATCH 2/6] libqblock public type defines Wenchao Xia
2012-09-03 13:13 ` Paolo Bonzini
2012-09-04 2:00 ` Wenchao Xia
2012-09-03 14:20 ` Eric Blake
2012-09-04 7:10 ` Wenchao Xia
2012-09-04 7:37 ` Paolo Bonzini
2012-09-03 19:31 ` Blue Swirl
2012-09-04 7:19 ` Wenchao Xia
2012-09-04 7:38 ` Paolo Bonzini
2012-09-04 19:22 ` Blue Swirl
2012-09-10 8:22 ` Wenchao Xia
2012-09-03 9:18 ` [Qemu-devel] [PATCH 3/6] libqblock error handling Wenchao Xia
2012-09-03 14:22 ` Eric Blake
2012-09-04 7:12 ` Wenchao Xia
2012-09-10 8:20 ` Wenchao Xia
2012-09-03 9:18 ` [Qemu-devel] [PATCH 4/6] libqblock internal used functions Wenchao Xia
2012-09-03 13:18 ` Paolo Bonzini
2012-09-04 3:19 ` Wenchao Xia
2012-09-03 14:28 ` Eric Blake
2012-09-03 15:18 ` Paolo Bonzini
2012-09-04 7:15 ` Wenchao Xia
2012-09-04 7:38 ` Paolo Bonzini
2012-09-04 11:38 ` Eric Blake
2012-09-04 13:49 ` Paolo Bonzini
2012-09-04 13:51 ` Kevin Wolf
2012-09-10 8:23 ` Wenchao Xia
2012-09-03 9:18 ` [Qemu-devel] [PATCH 5/6] libqblock test example Wenchao Xia
2012-09-03 19:27 ` Blue Swirl
2012-09-03 9:18 ` Wenchao Xia [this message]
2012-09-03 13:10 ` [Qemu-devel] xbzrle migration cache size advise for high memory changes workload ? Alexandre DERUMIER
2012-09-04 14:05 ` Orit Wasserman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346663926-20188-7-git-send-email-xiawenc@linux.vnet.ibm.com \
--to=xiawenc@linux.vnet.ibm.com \
--cc=aliguori@us.ibm.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).