diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-02-05 17:27:27 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-02-08 14:50:48 +0000 |
commit | 3144f78b3f8d517d32641a7b606b67e7b3cc16f7 (patch) | |
tree | c70fd4b32bdc9fe7f2a7753788581ffecedd9fa8 /rules.mak | |
parent | c3dc9fd5ac892b88b956d8c90c0e8de14c08e0fc (diff) |
rules.mak: Link with C++ if we have a C++ compiler
If we have a C++ compiler available, link with it, because we might be
linking some C++ files in. This allows us to include C++ object files
in the QEMU binary proper.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'rules.mak')
-rw-r--r-- | rules.mak | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -27,8 +27,12 @@ QEMU_INCLUDES += -I$(<D) -I$(@D) %.o: %.rc $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@") +# If we have a CXX we might have some C++ objects, in which case we +# must link with the C++ compiler, not the plain C compiler. +LINKPROG = $(or $(CXX),$(CC)) + ifeq ($(LIBTOOL),) -LINK = $(call quiet-command,$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ +LINK = $(call quiet-command,$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \ $(LIBS)," LINK $(TARGET_DIR)$@") else @@ -42,7 +46,7 @@ LIBTOOL += $(if $(V),,--quiet) LINK = $(call quiet-command,\ $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \ - )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ + )$(LINKPROG) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ \ $(sort $(filter %.o, $1)) $(filter-out %.o, $1) \ $(if $(filter %.lo %.la,$^),$(version-lobj-y),$(version-obj-y)) \ $(if $(filter %.lo %.la,$^),$(LIBTOOLFLAGS)) \ |