From: Alon Levy <alevy@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2/2] libcacard: add libcacard.la target
Date: Sun, 15 May 2011 18:40:18 +0300 [thread overview]
Message-ID: <1305474018-23235-3-git-send-email-alevy@redhat.com> (raw)
In-Reply-To: <1305474018-23235-1-git-send-email-alevy@redhat.com>
No flag to configure is required. Instead, added a libcacard.la target that
is not built by default, only when requested explicitly via:
mkdir build
cd build
../configure
make libcacard.la
make install-libcacard
Uses libtool to do actual linking of object files and shared library, and
installing. Tested only under linux, but supposed to work on other systems as
well.
Signed-off-by: Alon Levy <alevy@redhat.com>
---
Makefile | 9 +++++++++
configure | 2 +-
libcacard/Makefile | 30 ++++++++++++++++++++++++++----
3 files changed, 36 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 2b0438c..4bb6ca6 100644
--- a/Makefile
+++ b/Makefile
@@ -120,6 +120,15 @@ version.o: $(SRC_PATH)/version.rc config-host.mak
version-obj-$(CONFIG_WIN32) += version.o
######################################################################
+.PHONY: libcacard.la install-libcacard
+libcacard.la: $(GENERATED_HEADERS) $(oslib-obj-y) qemu-malloc.o qemu-timer-common.o $(trace-obj-y)
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" libcacard.la,)
+
+install-libcacard: libcacard.la
+ $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,)
+
+######################################################################
+
qemu-img.o: qemu-img-cmds.h
qemu-img.o qemu-tool.o qemu-nbd.o qemu-io.o cmd.o: $(GENERATED_HEADERS)
diff --git a/configure b/configure
index 0627f1d..26e32f3 100755
--- a/configure
+++ b/configure
@@ -3595,7 +3595,7 @@ if [ "$source_path" != `pwd` ]; then
# out of tree build
mkdir -p libcacard
rm -f libcacard/Makefile
- ln -s "$source_path/libcacard/Makefile" libcacard/Makefile
+ ln -s -f "$source_path/libcacard/Makefile" libcacard/Makefile
fi
d=libuser
diff --git a/libcacard/Makefile b/libcacard/Makefile
index 1d34df0..8abad26 100644
--- a/libcacard/Makefile
+++ b/libcacard/Makefile
@@ -4,15 +4,37 @@
$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/libcacard)
-QEMU_OBJS=$(addprefix ../, $(oslib-obj-y) $(trace-obj-y) qemu-malloc.o qemu-timer-common.o)
+QEMU_TRACE_OBJS=$(addprefix ../,$(trace-obj-y))
+
+QEMU_BASE_OBJS=$(addprefix ../,$(oslib-obj-y) qemu-malloc.o qemu-timer-common.o)
+
+# objects linked against normal qemu binaries, not compiled with libtool
+QEMU_OBJS = $(QEMU_BASE_OBJS) $(QEMU_TRACE_OBJS)
+
+# objects linked into a shared library, built with libtool with -fPIC if required
+QEMU_BASE_OBJS_LIB=$(addsuffix .lo,$(basename $(QEMU_BASE_OBJS)))
+
+QEMU_OBJS_LIB = $(QEMU_BASE_OBJS_LIB) $(QEMU_TRACE_OBJS)
QEMU_CFLAGS+=-I../
+libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y)))
+
vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o
- $(call quiet-command,$(CC) $(libcacard_libs) -lrt -o $@ $^," LINK $(TARGET_DIR)$@")
+ $(call quiet-command,$(CC) $(libcacard_libs) -lrt -o $@ $^," LINK $@")
-all: vscclient
+$(libcacard.lib-y) $(QEMU_BASE_OBJS_LIB) : %.lo: %.c
+ $(call quiet-command,libtool --mode=compile --quiet --tag=CC $(CC) $(QEMU_CFLAGS) $(QEMU_INCLUDES) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," lt CC $@")
+
+libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB)
+ $(call quiet-command,libtool --mode=link --quiet --tag=CC $(CC) $(libcacard_libs) -lrt -rpath $(libdir) -o $@ $^," lt LINK $@")
clean:
- rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient
+ rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient libcacard.so *.lo .libs/* *.la
+ rm -Rf .libs
+install-libcacard: libcacard.la
+ $(INSTALL_DIR) "$(DESTDIR)$(libdir)"
+ libtool --mode=install $(INSTALL_PROG) libcacard.la "$(DESTDIR)$(libdir)"
+
+all: vscclient
--
1.7.5.1
next prev parent reply other threads:[~2011-05-15 15:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-15 15:40 [Qemu-devel] [PATCH 0/2] add libcacard shared object target Alon Levy
2011-05-15 15:40 ` [Qemu-devel] [PATCH 1/2] configure: add libdir and --libdir Alon Levy
2011-05-15 15:40 ` Alon Levy [this message]
2011-05-16 7:00 ` [Qemu-devel] [PATCH 2/2] libcacard: add libcacard.la target Paolo Bonzini
2011-05-16 10:25 ` Alon Levy
2011-05-16 10:32 ` Paolo Bonzini
2011-05-16 12:06 ` Gerd Hoffmann
2011-05-16 12:07 ` Paolo Bonzini
2011-05-16 12:14 ` Alon Levy
2011-05-16 12:18 ` Paolo Bonzini
2011-05-16 13:25 ` [Qemu-devel] [PATCH] " Alon Levy
2011-05-16 13:28 ` Anthony Liguori
2011-05-16 13:59 ` Paolo Bonzini
2011-05-16 17:37 ` Alon Levy
2011-05-16 14:44 ` Paolo Bonzini
2011-05-16 18:06 ` Alon Levy
2011-05-16 17:40 ` Alon Levy
2011-05-17 12:03 ` Alon Levy
2011-05-17 12:32 ` Alon Levy
[not found] ` <20110518034240.GL7083@playa.tlv.redhat.com>
2011-05-18 7:16 ` Paolo Bonzini
2011-05-18 8:49 ` Alon Levy
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=1305474018-23235-3-git-send-email-alevy@redhat.com \
--to=alevy@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).