Patchwork [3/4] libcacard: fix mingw64 cross-compilation

login
register
mail settings
Submitter Marc-André Lureau
Date Feb. 25, 2013, 5:56 p.m.
Message ID <1361815009-24145-3-git-send-email-marcandre.lureau@redhat.com>
Download mbox | patch
Permalink /patch/222989/
State New
Headers show

Comments

Marc-André Lureau - Feb. 25, 2013, 5:56 p.m.
From: Marc-André Lureau <marcandre.lureau@gmail.com>

Compile and link with version.lo

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 Makefile  | 8 ++++++--
 rules.mak | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)
Paolo Bonzini - Feb. 25, 2013, 6:11 p.m.
Il 25/02/2013 18:56, Marc-André Lureau ha scritto:
>  LINK = $(call quiet-command,\
>         $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \
>         )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBTOOLFLAGS) -o $@ \
> -       $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
> +       $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-lobj-y) \
>         $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", "  LINK  ")"$(TARGET_DIR)$@")

Unfortunately, this does not work if linking without libtool.

Paolo
Marc-André Lureau - Feb. 25, 2013, 6:16 p.m.
----- Mensaje original -----
> Il 25/02/2013 18:56, Marc-André Lureau ha scritto:
> >  LINK = $(call quiet-command,\
> >         $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC
> >         \
> >         )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBTOOLFLAGS)
> >         -o $@ \
> > -       $(sort $(filter %.o, $1)) $(filter-out %.o, $1)
> > $(version-obj-y) \
> > +       $(sort $(filter %.o, $1)) $(filter-out %.o, $1)
> > $(version-lobj-y) \
> >         $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", "  LINK
> >          ")"$(TARGET_DIR)$@")
> 
> Unfortunately, this does not work if linking without libtool.

Same problem with LIBTOOLFLAGS -Wc,-fstack-protector-all... I must say the qemu configure/build-sys gets me very confused.

Patch

diff --git a/Makefile b/Makefile
index 2262410..5f0ded1 100644
--- a/Makefile
+++ b/Makefile
@@ -148,11 +148,15 @@  recurse-all: $(SUBDIR_RULES) $(ROMSUBDIR_RULES)
 
 bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS)
 
-version.o: $(SRC_PATH)/version.rc config-host.h
+version.o: $(SRC_PATH)/version.rc config-host.h | version.lo
 	$(call quiet-command,$(WINDRES) -I. -o $@ $<,"  RC    $(TARGET_DIR)$@")
+version.lo: $(SRC_PATH)/version.rc config-host.h
+	$(call quiet-command,$(LIBTOOL) --mode=compile --tag=RC $(WINDRES) -I. -o $@ $<,"lt RC   $(TARGET_DIR)$@")
 
 version-obj-$(CONFIG_WIN32) += version.o
-Makefile: $(version-obj-y)
+version-lobj-$(CONFIG_WIN32) += $(if $(LIBTOOL),version.lo)
+Makefile: $(version-obj-y) $(version-lobj-y)
+
 
 ######################################################################
 # Build libraries
diff --git a/rules.mak b/rules.mak
index 0be8e60..939fb5e 100644
--- a/rules.mak
+++ b/rules.mak
@@ -35,7 +35,7 @@  LIBTOOL += $(if $(V),,--quiet)
 LINK = $(call quiet-command,\
        $(if $(filter %.lo %.la,$^),$(LIBTOOL) --mode=link --tag=CC \
        )$(CC) $(QEMU_CFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBTOOLFLAGS) -o $@ \
-       $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-obj-y) \
+       $(sort $(filter %.o, $1)) $(filter-out %.o, $1) $(version-lobj-y) \
        $(LIBS),$(if $(filter %.lo %.la,$^),"lt LINK ", "  LINK  ")"$(TARGET_DIR)$@")
 endif