w32: Build windows and console executables
PATCH v2 1/1 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.
--- Makefile.target | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)
Makefile.target +15 -1
@@ -27,10 +27,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
@@ -403,9 +410,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)$@")
Signature · 1 line
1.7.2.5
Quoted 50 lines · Stefan Weil
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.Signed-off-by Stefan Weil <[email protected]>---
Makefile.target | 16 +++++++++++++++-1 files changed, 15 insertions(+), 1 deletions(-)Makefile.target +0
-0@@ -27,10 +27,17 @@ ifdef CONFIG_USER_ONLY QEMU_PROG=qemu-$(TARGET_ARCH2)else
# system emulator nameMakefile.target +4
-0+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 executableQEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
endifPROGS=$(QEMU_PROG)
Makefile.target +3
-0+ifdef QEMU_PROGW +PROGS+=$(QEMU_PROGW) +endifSTPFILES=
ifndef
CONFIG_HAIKUMakefile.target +0
-0@@ -403,9 +410,16 @@ endif # CONFIG_LINUX_USERobj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
Makefile.target +7
-0+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,$^)
Makefile.target +1
-1- +endif
Quoted 5 lines
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.2.5
Failed to make:
Makefile:416: *** multiple target patterns. Stop.
Am 23.12.2011 03:31, schrieb TeLeMan:
Quoted 54 lines · Stefan Weil
Quoted 53 lines
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.Signed-off-by Stefan Weil <[email protected]>--- Makefile.target | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)Makefile.target +2
-0@@ -27,10 +27,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 awindows executable.
Makefile.target +7
-0+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@@ -403,9 +410,16 @@ endif # CONFIG_LINUX_USER obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o +ifdef QEMU_PROGW +# The linker builds a windows executable. Make also a consoleexecutable.
+$(QEMU_PROGW): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y)Makefile.target +3
-0+ $(call LINK,$^) +$(QEMU_PROG): $(QEMU_PROGW) + $(call quiet-command,$(OBJCOPY) --subsystem console$(QEMU_PROGW) $(QEMU_PROG)," GEN $(TARGET_DIR)$(QEMU_PROG)")
Makefile.target +2
-1+else $(QEMU_PROG): $(obj-y) $(obj-$(TARGET_BASE_ARCH)-y) $(call LINK,$^) - +endif
Quoted 8 lines
Quoted 6 lines
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.2.5Failed to make:
Makefile:416: *** multiple target patterns. Stop.
It works here (native and cross compilations) with MinGW, so I have to guess and need your help.
This is the relevant code from Makefile.target when my patch was applied:
$(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)")
Line 416 is the 2nd line which was not changed by my patch. It contains no target pattern at all.
Or do you have a different line counting caused by local modifications or an older version of the QEMU sources?
Does an empty line between 2nd and 3rd line help?
Do you run a native or a cross compilation?
If native: which line endings do you use (CRLF or LF, depends on git settings and MinGW mount options)? Do you use Cygwin, MinGW or MinGW-w64?
Which make do you use?
Try to run make in verbose mode (make V=1).
This page describes the error which you got:
http://www.gnu.org/savannah-checkouts/gnu/make/manual/html_node/Error-Messages.html
Cheers,
Stefan Weil
Quoted 96 lines · Stefan Weil
Am 23.12.2011 03:31, schrieb TeLeMan:
Quoted 56 lines · Stefan Weil
Quoted 55 lines
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.Signed-off-by Stefan Weil <[email protected]>---
Makefile.target | 16 +++++++++++++++-1 files changed, 15 insertions(+), 1 deletions(-)Makefile.target +0
-0@@ -27,10 +27,17 @@ ifdef CONFIG_USER_ONLY QEMU_PROG=qemu-$(TARGET_ARCH2)else
# system emulator nameMakefile.target +2
-0+ifneq (,$(findstring -mwindows,$(LIBS))) +# Terminate program name with a 'w' because the linker builds a windowsexecutable.
Makefile.target +2
-0+QEMU_PROGW=qemu-system-$(TARGET_ARCH2)w$(EXESUF) +endif # windows executableQEMU_PROG=qemu-system-$(TARGET_ARCH2)$(EXESUF)
endifPROGS=$(QEMU_PROG)
Makefile.target +3
-0+ifdef QEMU_PROGW +PROGS+=$(QEMU_PROGW) +endifSTPFILES=
ifndef
CONFIG_HAIKUMakefile.target +0
-0@@ -403,9 +410,16 @@ endif # CONFIG_LINUX_USERobj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
Makefile.target +2
-0+ifdef QEMU_PROGW +# The linker builds a windows executable. Make also a consoleexecutable.
+$(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,$^)Makefile.target +1
-1- +endifQuoted 9 lines
Quoted 7 lines
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.2.5Failed to make:
Makefile:416: *** multiple target patterns. Stop.It works here (native and cross compilations) with MinGW, so I have to guess and need your help.
This is the relevant code from Makefile.target when my patch was applied:
$(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)")
Line 416 is the 2nd line which was not changed by my patch. It contains no target pattern at all.
Or do you have a different line counting caused by local modifications or an older version of the QEMU sources?
Does an empty line between 2nd and 3rd line help?
Do you run a native or a cross compilation?
If native: which line endings do you use (CRLF or LF, depends on git settings and MinGW mount options)? Do you use Cygwin, MinGW or MinGW-w64?
Which make do you use?
Quoted 4 lines
Try to run make in verbose mode (make V=1).
This page describes the error which you got:
http://www.gnu.org/savannah-checkouts/gnu/make/manual/html_node/Error-Messages.html
I found this problem. After I copied & pasted your patch, the tabs were converted to spaces.
Thanks for your patience. Now it is working.
Quoted 4 lines
Cheers,
Stefan Weil
Am 22.12.2011 11:20, schrieb Stefan Weil:
Quoted 43 lines
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.Signed-off-by Stefan Weil<[email protected]>--- Makefile.target | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)Makefile.target +11
-0@@ -27,10 +27,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@@ -403,9 +410,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,$^)
Makefile.target endif # CONFIG_LINUX_USER · line 425
Quoted 10 lines
Makefile.target +4
-1+$(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)$@")
Ping? All open questions were solved, so this patch can be committed.
Thanks,
Stefan W.
Am 13.01.2012 22:13, schrieb Stefan Weil:
Quoted 9 lines
Am 22.12.2011 11:20, schrieb Stefan Weil:
Quoted 8 lines
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.
Quoted 6 lines
Quoted 4 lines
Signed-off-by Stefan Weil<[email protected]>--- Makefile.target | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-)Ping? All open questions were solved, so this patch can be committed.
No objection to this patch, just raising the question whether we might want to compile code differently for the two targets? For example, does -nographic make sense for the *w.exe?
Andreas
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Am 13.01.2012 22:31, schrieb Andreas Färber:
Quoted 15 lines
Am 13.01.2012 22:13, schrieb Stefan Weil:
Quoted 13 lines
Am 22.12.2011 11:20, schrieb Stefan Weil:
Quoted 12 lines
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 usesQEMU_PROGW/QEMU_PROGinstead ofQEMU_PROG/QEMU_PROGC.Signed-off-by Stefan Weil<[email protected]>---
Makefile.target | 16 +++++++++++++++-1 files changed, 15 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 1 line
Ping? All open questions were solved, so this patch can be committed.
No objection to this patch, just raising the question whether we might want to compile code differently for the two targets? For example, does -nographic make sense for the *w.exe?
Andreas
Yes, it makes sense.
It's possible to run a *w.exe with stdin/stdout redirected to a pipe. The msys rxvt terminal works like that and allows -nographics.
And even without such tricks, the commonly used SDL implementations redirect stdout to a file, so it is possible to run a *w.exe with -nographic and use the file (for example in automated tests which boot a Linux kernel).
So I see no reason to compile both executables differently.
Having executables which are binary compatible has also advantages for installers (compressing twice the same binary data should be easy).
Regards,
Stefan