From patchwork Sun May 15 15:40:18 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 95652 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A1389B6F06 for ; Mon, 16 May 2011 01:40:52 +1000 (EST) Received: from localhost ([::1]:42311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLdR3-0004Ur-RW for incoming@patchwork.ozlabs.org; Sun, 15 May 2011 11:40:49 -0400 Received: from eggs.gnu.org ([140.186.70.92]:49331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLdQf-0004Th-72 for qemu-devel@nongnu.org; Sun, 15 May 2011 11:40:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QLdQe-00063d-4f for qemu-devel@nongnu.org; Sun, 15 May 2011 11:40:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:61582) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QLdQd-00063R-Th for qemu-devel@nongnu.org; Sun, 15 May 2011 11:40:24 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4FFeNbV012814 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 15 May 2011 11:40:23 -0400 Received: from playa.tlv.redhat.com (dhcp-3-110.tlv.redhat.com [10.35.3.110]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p4FFeJVZ026952 for ; Sun, 15 May 2011 11:40:22 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Sun, 15 May 2011 18:40:18 +0300 Message-Id: <1305474018-23235-3-git-send-email-alevy@redhat.com> In-Reply-To: <1305474018-23235-1-git-send-email-alevy@redhat.com> References: <1305474018-23235-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 2/2] libcacard: add libcacard.la target X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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