aboutsummaryrefslogtreecommitdiff
path: root/rules.mak
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-12-20 18:57:45 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2013-01-12 17:19:09 +0100
commit2165588274332e9f08891d5b22d56f4c0b7dc437 (patch)
tree4f47a90371167c151f51cb4d6c076aeb663b549c /rules.mak
parentf141ccfa15096a7610b9973ae5ebae6562625a8d (diff)
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>
Diffstat (limited to 'rules.mak')
-rw-r--r--rules.mak10
1 files changed, 8 insertions, 2 deletions
diff --git a/rules.mak b/rules.mak
index 927301251e..4673aada07 100644
--- a/rules.mak
+++ b/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,$^)