summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2011-12-22 11:18:53 +0100
committerStefan Weil <sw@weilnetz.de>2012-02-07 18:11:41 +0100
commit0fa5491eed8ff4fe63cb63c93ce37ff76de7c010 (patch)
tree5df5cfb70155b430a86a7268d0ad817a8980a71e
parente87f7fc67948da80a0452c4fd523ec45f0d03f26 (diff)
downloadfocaccia-qemu-0fa5491eed8ff4fe63cb63c93ce37ff76de7c010.tar.gz
focaccia-qemu-0fa5491eed8ff4fe63cb63c93ce37ff76de7c010.zip
w32: Build windows and console executables
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.

v2:
This version uses QEMU_PROGW / QEMU_PROG instead of QEMU_PROG / QEMU_PROGC.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
-rw-r--r--Makefile.target16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile.target b/Makefile.target
index 68481a3a6c..7ed497942a 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -29,10 +29,17 @@ 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_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF)
+endif # windows executable
 QEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
 endif
 
 PROGS=$(QEMU_PROG)
+ifdef QEMU_PROGW
+PROGS+=$(QEMU_PROGW)
+endif
 STPFILES=
 
 ifndef CONFIG_HAIKU
@@ -407,9 +414,16 @@ endif # CONFIG_LINUX_USER
 
 obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
 
+ifdef QEMU_PROGW
+# The linker builds a windows executable. Make also a console executable.
+$(QEMU_PROGW): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
+	$(call LINK,$^)
+$(QEMU_PROG): $(QEMU_PROGW)
+	$(call quiet-command,$(OBJCOPY) --subsystem console $(QEMU_PROGW) $(QEMU_PROG),"  GEN   $(TARGET_DIR)$(QEMU_PROG)")
+else
 $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)
 	$(call LINK,$^)
-
+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)$@")