build: support linking with libtool objects/libraries
This patch moves the complication of using libtool to the generic rules.mak file. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f141ccfa15
commit
2165588274
8
configure
vendored
8
configure
vendored
@ -3721,7 +3721,13 @@ echo "MAKE=$make" >> $config_host_mak
|
||||
echo "INSTALL=$install" >> $config_host_mak
|
||||
echo "INSTALL_DIR=$install -d -m 0755" >> $config_host_mak
|
||||
echo "INSTALL_DATA=$install -c -m 0644" >> $config_host_mak
|
||||
echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
|
||||
if test -n "$libtool"; then
|
||||
echo "INSTALL_PROG=\$(LIBTOOL) --mode=install $install -c -m 0755" >> $config_host_mak
|
||||
echo "INSTALL_LIB=\$(LIBTOOL) --mode=install $install -c -m 0644" >> $config_host_mak
|
||||
else
|
||||
echo "INSTALL_PROG=$install -c -m 0755" >> $config_host_mak
|
||||
echo "INSTALL_LIB=$install -c -m 0644" >> $config_host_mak
|
||||
fi
|
||||
echo "PYTHON=$python" >> $config_host_mak
|
||||
echo "CC=$cc" >> $config_host_mak
|
||||
echo "CC_I386=$cc_i386" >> $config_host_mak
|
||||
|
@ -10,6 +10,9 @@ $(call set-vpath, $(SRC_PATH))
|
||||
QEMU_OBJS=$(oslib-obj-y) qemu-timer-common.o $(trace-obj-y) $(stub-obj-y)
|
||||
QEMU_OBJS_LIB=$(patsubst %.o,%.lo,$(QEMU_OBJS))
|
||||
|
||||
# libtool will build the .o files, too
|
||||
$(libcacard-obj-y): | $(libcacard-lobj-y)
|
||||
|
||||
QEMU_CFLAGS+=-I../
|
||||
|
||||
libcacard.lib-y=$(patsubst %.o,%.lo,$(libcacard-y))
|
||||
@ -54,10 +57,10 @@ install-libcacard: libcacard.pc libcacard.la vscclient
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(libdir)/pkgconfig"
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(libcacard_includedir)"
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(bindir)"
|
||||
$(LIBTOOL) --mode=install $(INSTALL_PROG) vscclient "$(DESTDIR)$(bindir)"
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) libcacard.la "$(DESTDIR)$(libdir)"
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) libcacard.pc "$(DESTDIR)$(libdir)/pkgconfig"
|
||||
$(INSTALL_PROG) vscclient "$(DESTDIR)$(bindir)"
|
||||
$(INSTALL_LIB) libcacard.la "$(DESTDIR)$(libdir)"
|
||||
$(INSTALL_DATA) libcacard.pc "$(DESTDIR)$(libdir)/pkgconfig"
|
||||
for inc in *.h; do \
|
||||
$(LIBTOOL) --mode=install $(INSTALL_DATA) $(libcacard_srcpath)/$$inc "$(DESTDIR)$(libcacard_includedir)"; \
|
||||
$(INSTALL_DATA) $(libcacard_srcpath)/$$inc "$(DESTDIR)$(libcacard_includedir)"; \
|
||||
done
|
||||
endif
|
||||
|
10
rules.mak
10
rules.mak
@ -23,10 +23,18 @@ QEMU_CFLAGS += -I$(<D) -I$(@D)
|
||||
ifeq ($(LIBTOOL),)
|
||||
%.lo: %.c
|
||||
@echo "missing libtool. please install and rerun configure"; exit 1
|
||||
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) \
|
||||
$(LIBS)," LINK $(TARGET_DIR)$@")
|
||||
else
|
||||
LIBTOOL += $(if $(V),,--quiet)
|
||||
%.lo: %.c
|
||||
$(call quiet-command,$(LIBTOOL) --mode=compile --tag=CC $(CC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," lt CC $@")
|
||||
LINK = $(call quiet-command,\
|
||||
$(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \
|
||||
)$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \
|
||||
$(sort $(filter %.o, $1)) $(filter-out %.o, $1) \
|
||||
$(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", " LINK ")"$(TARGET_DIR)$@")
|
||||
endif
|
||||
|
||||
%.asm: %.S
|
||||
@ -38,8 +46,6 @@ endif
|
||||
%.o: %.m
|
||||
$(call quiet-command,$(OBJCC) $(QEMU_INCLUDES) $(QEMU_CFLAGS) $(QEMU_DGFLAGS) $(CFLAGS) -c -o $@ $<," OBJC $(TARGET_DIR)$@")
|
||||
|
||||
LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(LIBS)," LINK $(TARGET_DIR)$@")
|
||||
|
||||
%$(EXESUF): %.o
|
||||
$(call LINK,$^)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user