From 00c705fb92bc6e69e955aeac3614e05ca02feacd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 29 May 2012 11:40:24 +0200 Subject: [PATCH] build: libcacard Makefile cleanups Build vscclient from toplevel Makefile, limit usage of vpath. Signed-off-by: Paolo Bonzini --- Makefile | 4 ++++ Makefile.objs | 8 +++++++- Makefile.target | 6 ------ configure | 12 +++++------- libcacard/Makefile | 17 ++++++----------- 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Makefile b/Makefile index a10005a22f..1d34b9539e 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,10 @@ libcacard.la: $(oslib-obj-y) qemu-timer-common.o $(addsuffix .lo, $(basename $(t install-libcacard: libcacard.la $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C libcacard V="$(V)" TARGET_DIR="$*/" install-libcacard,) endif + +vscclient$(EXESUF): $(libcacard-y) $(oslib-obj-y) qemu-timer-common.o libcacard/vscclient.o + $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@") + ###################################################################### qemu-img.o: qemu-img-cmds.h diff --git a/Makefile.objs b/Makefile.objs index ae3770a5f7..74110dda7e 100644 --- a/Makefile.objs +++ b/Makefile.objs @@ -198,7 +198,13 @@ $(trace-obj-y): $(GENERATED_HEADERS) ###################################################################### # smartcard -libcacard-y = cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o card_7816.o +libcacard-y += libcacard/cac.o libcacard/event.o +libcacard-y += libcacard/vcard.o libcacard/vreader.o +libcacard-y += libcacard/vcard_emul_nss.o +libcacard-y += libcacard/vcard_emul_type.o +libcacard-y += libcacard/card_7816.o + +common-obj-$(CONFIG_SMARTCARD_NSS) += $(libcacard-y) ###################################################################### # qapi diff --git a/Makefile.target b/Makefile.target index 3dfdf925fd..555894db4a 100644 --- a/Makefile.target +++ b/Makefile.target @@ -164,16 +164,10 @@ all-obj-y = $(obj-y) all-obj-y += $(addprefix ../, $(universal-obj-y)) ifdef CONFIG_SOFTMMU - all-obj-y += $(addprefix ../, $(common-obj-y)) all-obj-y += $(addprefix ../libdis/, $(libdis-y)) all-obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) all-obj-y += $(addprefix ../, $(trace-obj-y)) - -# libcacard needs qemu-thread support, and besides is only needed by devices -# so not requires with linux-user / bsd-user targets -all-obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) - else all-obj-y += $(addprefix ../libuser/, $(user-obj-y)) all-obj-y += $(addprefix ../libdis-user/, $(libdis-y)) diff --git a/configure b/configure index e50ad0bb8f..cd5e8b349c 100755 --- a/configure +++ b/configure @@ -2927,6 +2927,9 @@ if test "$softmmu" = yes ; then fi fi fi +if test "$smartcard_nss" = "yes" ; then + tools="vscclient\$(EXESUF) $tools" +fi # Mac OS X ships with a broken assembler roms= @@ -3959,9 +3962,10 @@ DIRS="$DIRS roms/seabios roms/vgabios" DIRS="$DIRS fsdev ui hw hw/usb" DIRS="$DIRS qapi qapi-generated" DIRS="$DIRS qga trace qom" +DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace" FILES="Makefile tests/tcg/Makefile qdict-test-data.txt" FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" -FILES="$FILES tests/tcg/lm32/Makefile" +FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile" FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps" FILES="$FILES pc-bios/spapr-rtas/Makefile" FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile" @@ -4005,12 +4009,6 @@ for hwlib in 32 64; do echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak done -if [ "$source_path" != `pwd` ]; then - # out of tree build - mkdir -p libcacard - symlink "$source_path/libcacard/Makefile" libcacard/Makefile -fi - d=libuser mkdir -p $d mkdir -p $d/trace diff --git a/libcacard/Makefile b/libcacard/Makefile index c6a896a739..fdc287370d 100644 --- a/libcacard/Makefile +++ b/libcacard/Makefile @@ -2,29 +2,23 @@ -include $(SRC_PATH)/Makefile.objs -include $(SRC_PATH)/rules.mak -libcacard_srcpath=$(SRC_PATH)/libcacard libcacard_includedir=$(includedir)/cacard -$(call set-vpath, $(SRC_PATH):$(libcacard_srcpath)) - -# objects linked against normal qemu binaries, not compiled with libtool -QEMU_OBJS=$(addprefix ../,$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y)) +$(call set-vpath, $(SRC_PATH)) # objects linked into a shared library, built with libtool with -fPIC if required -QEMU_OBJS_LIB=$(addsuffix .lo,$(basename $(QEMU_OBJS))) +QEMU_OBJS=$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y) +QEMU_OBJS_LIB=$(patsubst %.o,%.lo,$(QEMU_OBJS)) QEMU_CFLAGS+=-I../ -libcacard.lib-y=$(addsuffix .lo,$(basename $(libcacard-y))) - -vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o - $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@") +libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y)) clean: rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo .libs/* *.la *.pc rm -Rf .libs -all: vscclient +all: libcacard.la libcacard.pc # Dummy command so that make thinks it has done something @true @@ -41,6 +35,7 @@ else libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB) $(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs)," lt LINK $@") +libcacard_srcpath=$(SRC_PATH)/libcacard libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in sed -e 's|@LIBDIR@|$(libdir)|' \ -e 's|@INCLUDEDIR@|$(libcacard_includedir)|' \ -- GitLab