diff mbox

w32: Build windows and console executables

Message ID 1324541033-29004-1-git-send-email-sw@weilnetz.de
State Superseded
Headers show

Commit Message

Stefan Weil Dec. 22, 2011, 8:03 a.m. UTC
System emulation executables with SDL are typically windows
executables. Sometimes console executables are more useful,
so create both variants if linker option -mwindows was detected.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 Makefile.target |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

Comments

TeLeMan Dec. 22, 2011, 9:22 a.m. UTC | #1
On Thu, Dec 22, 2011 at 16:03, Stefan Weil <sw@weilnetz.de> wrote:
> System emulation executables with SDL are typically windows
> executables. Sometimes console executables are more useful,
> so create both variants if linker option -mwindows was detected.
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
>  Makefile.target |   14 ++++++++++++++
>  1 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/Makefile.target b/Makefile.target
> index 3261383..489a80c 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -27,10 +27,19 @@ ifdef CONFIG_USER_ONLY
>  QEMU_PROG=qemu-$(TARGET_ARCH2)
>  else
>  # system emulator name
> +ifneq (,$(findstring -mwindows,$(LIBS)))
> +# Terminate program name with a 'w' because the linker builds a windows executable.
> +QEMU_PROG=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
> +QEMU_PROGC=qemu-system-$(TARGET_ARCH2)$(EXESUF)
> +else # windows executable
>  QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
> +endif # windows executable
>  endif
I prefer QEMU_PROG & QEMU_PROGW.

>  PROGS=$(QEMU_PROG)
> +ifdef QEMU_PROGC
> +PROGS+=$(QEMU_PROGC)
> +endif
>  STPFILES=
>
>  ifndef CONFIG_HAIKU
> @@ -406,6 +415,11 @@ obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
>  $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
>        $(call LINK,$^)
>
> +ifdef QEMU_PROGC
> +# The linker built a windows executable. Make also a console executable.
> +$(QEMU_PROGC): $(QEMU_PROG)
> +       $(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROG) $(QEMU_PROGC),"  GEN   $(QEMU_PROGC)")
> +endif
>
>  gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
>        $(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")
> --
> 1.7.0.4
>
diff mbox

Patch

diff --git a/Makefile.target b/Makefile.target
index 3261383..489a80c 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -27,10 +27,19 @@  ifdef CONFIG_USER_ONLY
 QEMU_PROG=qemu-$(TARGET_ARCH2)
 else
 # system emulator name
+ifneq (,$(findstring -mwindows,$(LIBS)))
+# Terminate program name with a 'w' because the linker builds a windows executable.
+QEMU_PROG=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
+QEMU_PROGC=qemu-system-$(TARGET_ARCH2)$(EXESUF)
+else # windows executable
 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
+endif # windows executable
 endif
 
 PROGS=$(QEMU_PROG)
+ifdef QEMU_PROGC
+PROGS+=$(QEMU_PROGC)
+endif
 STPFILES=
 
 ifndef CONFIG_HAIKU
@@ -406,6 +415,11 @@  obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
 	$(call LINK,$^)
 
+ifdef QEMU_PROGC
+# The linker built a windows executable. Make also a console executable.
+$(QEMU_PROGC): $(QEMU_PROG)
+	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROG) $(QEMU_PROGC),"  GEN   $(QEMU_PROGC)")
+endif
 
 gdbstub-xml.c: $(TARGET_XML_FILES) $(SRC_PATH)/scripts/feature_to_c.sh
 	$(call quiet-command,rm -f $@ && $(SHELL) $(SRC_PATH)/scripts/feature_to_c.sh $@ $(TARGET_XML_FILES),"  GEN   $(TARGET_DIR)$@")