]> git.proxmox.com Git - mirror_qemu.git/blame - libcacard/Makefile
build: support linking with libtool objects/libraries
[mirror_qemu.git] / libcacard / Makefile
CommitLineData
111a38b0 1-include ../config-host.mak
111a38b0 2-include $(SRC_PATH)/rules.mak
31a32289 3-include $(SRC_PATH)/Makefile.objs
111a38b0 4
0f94d6da
AL
5libcacard_includedir=$(includedir)/cacard
6
00c705fb 7$(call set-vpath, $(SRC_PATH))
44dc0ca3
AL
8
9# objects linked into a shared library, built with libtool with -fPIC if required
a636be69 10QEMU_OBJS=$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y) $(stub-obj-y)
00c705fb 11QEMU_OBJS_LIB=$(patsubst %.o,%.lo,$(QEMU_OBJS))
111a38b0 12
21655882
PB
13# libtool will build the .o files, too
14$(libcacard-obj-y): | $(libcacard-lobj-y)
15
111a38b0
RR
16QEMU_CFLAGS+=-I../
17
00c705fb 18libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y))
44dc0ca3 19
2e679780
JM
20vscclient: $(libcacard-y) $(QEMU_OBJS) vscclient.o cutils.o
21 $(call quiet-command,$(CC) -o $@ $^ $(libcacard_libs) $(LIBS)," LINK $@")
22
44dc0ca3 23clean:
47ecbdf0
BS
24 rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ vscclient *.lo */*.lo .libs/* */.libs/* *.la */*.la *.pc
25 rm -Rf .libs */.libs
2ac85b93 26
00c705fb 27all: libcacard.la libcacard.pc
c2162a8b
JK
28# Dummy command so that make thinks it has done something
29 @true
2ac85b93 30
44dc0ca3
AL
31#########################################################################
32# Rules for building libcacard standalone library
33
34ifeq ($(LIBTOOL),)
35libcacard.la:
36 @echo "libtool is missing, please install and rerun configure"; exit 1
37
38install-libcacard:
39 @echo "libtool is missing, please install and rerun configure"; exit 1
40else
41libcacard.la: $(libcacard.lib-y) $(QEMU_OBJS_LIB)
f141ccfa 42 $(call quiet-command,$(LIBTOOL) --mode=link --tag=CC $(CC) -rpath $(libdir) -o $@ $^ $(libcacard_libs)," lt LINK $@")
111a38b0 43
00c705fb 44libcacard_srcpath=$(SRC_PATH)/libcacard
0f94d6da 45libcacard.pc: $(libcacard_srcpath)/libcacard.pc.in
47ecbdf0 46 $(call quiet-command,sed -e 's|@LIBDIR@|$(libdir)|' \
0f94d6da
AL
47 -e 's|@INCLUDEDIR@|$(libcacard_includedir)|' \
48 -e 's|@VERSION@|$(shell cat $(SRC_PATH)/VERSION)|' \
49 -e 's|@PREFIX@|$(prefix)|' \
47ecbdf0
BS
50 < $(libcacard_srcpath)/libcacard.pc.in > libcacard.pc,\
51 " GEN $@")
0f94d6da
AL
52
53.PHONY: install-libcacard
54
55install-libcacard: libcacard.pc libcacard.la vscclient
44dc0ca3 56 $(INSTALL_DIR) "$(DESTDIR)$(libdir)"
0f94d6da
AL
57 $(INSTALL_DIR) "$(DESTDIR)$(libdir)/pkgconfig"
58 $(INSTALL_DIR) "$(DESTDIR)$(libcacard_includedir)"
59 $(INSTALL_DIR) "$(DESTDIR)$(bindir)"
21655882
PB
60 $(INSTALL_PROG) vscclient "$(DESTDIR)$(bindir)"
61 $(INSTALL_LIB) libcacard.la "$(DESTDIR)$(libdir)"
62 $(INSTALL_DATA) libcacard.pc "$(DESTDIR)$(libdir)/pkgconfig"
0f94d6da 63 for inc in *.h; do \
21655882 64 $(INSTALL_DATA) $(libcacard_srcpath)/$$inc "$(DESTDIR)$(libcacard_includedir)"; \
0f94d6da 65 done
44dc0ca3 66endif