Skip to contentSkip to conversation

Makefile question

Qemu-devel Robert Riebisch 4 participants 21 messages Sep 25, 2008 – Sep 26, 2008 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi all!

I'm trying to enhance my personal Win32 build of QEMU 0.9.1. Because I wish to make it a "single click build", I'd like to correctly add a new object file to be linked into $(TARGET_DIRS)/qemu.exe ("i386-softmmu" at least) to the makefiles. (This object file will not be made from a .c file.)

Unfortunately I'm no makefile expert. Please, could someone give me some hints, what and where to add to the makefiles? OBJS? VL_OBJS? Create new EXTRA_OBJS?

Thanks in advance!

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#1 lore raw
Quoted 8 lines · Robert Riebisch

Hi all!

I'm trying to enhance my personal Win32 build of QEMU 0.9.1. Because I wish to make it a "single click build", I'd like to correctly add a new object file to be linked into $(TARGET_DIRS)/qemu.exe ("i386-softmmu" at least) to the makefiles. (This object file will not be made from a .c file.)

Where does the object file come from?

You need to provide a bit more detail for anyone to be able to help you.

Regards,

Anthony Liguori

Quoted 8 lines

Unfortunately I'm no makefile expert. Please, could someone give me some hints, what and where to add to the makefiles? OBJS? VL_OBJS? Create new EXTRA_OBJS?

Thanks in advance!

Robert Riebisch

#2 lore raw
Quoted 1 line · Anthony Liguori

Where does the object file come from?

Generated from .rc by `windres'.

Quoted 1 line

You need to provide a bit more detail for anyone to be able to help you.

I hoped, there were enough details in my first mail. ;-)

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#3 lore raw

I have made

Quoted 5 lines · Robert Riebisch
Quoted 1 line · Anthony Liguori

Where does the object file come from?

Generated from .rc by `windres'.

I have made a patch that uses windres to identify the version number of the app. The patch is in the attachments. Perhaps you can get some pointers from it.

Makefile.target +4 -0
Index: Makefile.target
===================================================================
@@ -661,6 +665,7 @@
 
 ifdef CONFIG_WIN32
 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
+OBJS+=version.o
 endif
 
 # profiling code
@@ -676,6 +681,9 @@
 
 %.o: %.c
 	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+	
+%.o: %.rc
+	windres -I. -DORIGINAL_FILENAME=\"$(QEMU_PROG)\" -c -o $< $@
 
 %.o: %.S
 	$(CC) $(CPPFLAGS) -c -o $@ $<
configure +4 -0
Index: configure
===================================================================
@@ -1319,6 +1319,10 @@
 echo "# Automatically generated by configure - do not modify" > $config_mak
 echo "/* Automatically generated by configure - do not modify */" > $config_h
 
+if test "$mingw32" = "yes" ; then
+echo "#define QEMU_FILEVERSION $(tr . , < $source_path/VERSION),0" >> $config_h
+echo "#define QEMU_PRODUCTVERSION $(tr . , < $source_path/VERSION),0" >> $config_h
+fi
 
 echo "include ../config-host.mak" >> $config_mak
 echo "#include \"../config-host.h\"" >> $config_h
version.rc new file +22 -0
Index: version.rc
===================================================================
@@ -0,0 +1,22 @@
+#include "config.h"
+
+1 VERSIONINFO
+FILEVERSION QEMU_FILEVERSION
+PRODUCTVERSION QEMU_PRODUCTVERSION
+FILETYPE 0x1 //VFT_APP
+ {
+BLOCK "StringFileInfo"
+  {
+  BLOCK "040904E4"
+  {
+   VALUE "FileDescription", "Qemu System emulator, " TARGET_ARCH " version"
+   VALUE "FileVersion", QEMU_VERSION
+   VALUE "LegalCopyright", "GNU General Public License"
+   VALUE "ProductName", "Qemu"
+  }
+ }
+BLOCK "VarFileInfo"
+ {
+  VALUE "Translation", 0x0409, 1252
+ }
+}
#4 lore raw
Quoted 3 lines · C.W. Betts

I have made a patch that uses windres to identify the version number of the app. The patch is in the attachments. Perhaps you can get some pointers from it.

I already knew your patch, but as nobody committed it to the SVN repository there seems to be "something wrong" with it.

Anthony? Johannes?

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#5 lore raw
Quoted 11 lines · Robert Riebisch
Quoted 4 lines · C.W. Betts

I have made a patch that uses windres to identify the version number of the app. The patch is in the attachments. Perhaps you can get some pointers from it.

I already knew your patch, but as nobody committed it to the SVN repository there seems to be "something wrong" with it.

I hadn't seen the patch previously. Other than the comments I just posted, it looks fine.

Regards,

Anthony Liguori

Quoted 4 lines

Anthony? Johannes?

Robert Riebisch

#6 lore raw
Quoted 1 line · Anthony Liguori

I hadn't seen the patch previously.

It has been posted here by C.W. in February.

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#7 lore raw
In reply to C.W. Betts
Quoted 3 lines · C.W. Betts

I have made a patch that uses windres to identify the version number of the app. The patch is in the attachments. Perhaps you can get some pointers from it.

I already knew your patch, but as nobody committed it to the SVN repository there seems to be "something wrong" with it.

Anthony? Johannes?

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#8 lore raw
In reply to C.W. Betts
Quoted 23 lines · C.W. Betts

I have made

Quoted 5 lines · Robert Riebisch
Quoted 1 line · Anthony Liguori

Where does the object file come from?

Generated from .rc by `windres'.

I have made a patch that uses windres to identify the version number of the app. The patch is in the attachments. Perhaps you can get some pointers from it.

Index: Makefile.target
===================================================================

Makefile.target (working copy) renamed from Makefile.target (revision 5321) +1 -0
@@ -661,6 +665,7 @@
 
 ifdef CONFIG_WIN32
 SDL_LIBS := $(filter-out -mwindows, $(SDL_LIBS)) -mconsole
+OBJS+=version.o
 endif
 
 # profiling code

Makefile.target (working copy) line 686

Quoted 6 lines
Makefile.target (working copy) renamed from Makefile.target (revision 5321) +3 -0
@@ -676,6 +681,9 @@
 
 %.o: %.c
     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+   
+%.o: %.rc
+    windres -I. -DORIGINAL_FILENAME=\"$(QEMU_PROG)\" -c -o $< $@

This needs to be ${cross_prefix}windres

Quoted 16 lines
Makefile.target (working copy) renamed from Makefile.target (revision 5321) +0 -0
 %.o: %.S
     $(CC) $(CPPFLAGS) -c -o $@ $<

Index: configure
===================================================================

configure (working copy) renamed from configure (revision 5321) +0 -0
@@ -1319,6 +1319,10 @@
 echo "# Automatically generated by configure - do not modify" > 

$config_mak
echo "/* Automatically generated by configure - do not modify */" >
$config_h

configure (working copy) renamed from configure (revision 5321) +2 -0
+if test "$mingw32" = "yes" ; then
+echo "#define QEMU_FILEVERSION $(tr . , < $source_path/VERSION),0" >> 

$config_h
+echo "#define QEMU_PRODUCTVERSION $(tr . , < $source_path/VERSION),0"

Quoted 3 lines
Quoted 1 line
Quoted 1 line

$config_h

+fi

You could just use QEMU_VERSION in the .rc file

I think it's a good idea to include a default .rc file for the QEMU Windows build. If you update the patch, I'd be happy to apply it.

Regards,

Anthony Liguori

#9 lore raw
Quoted 5 lines · Anthony Liguori

Makefile.target line 686

Quoted 3 lines
Makefile.target +3 -0
+
+%.o: %.rc
+    windres -I. -DORIGINAL_FILENAME=\"$(QEMU_PROG)\" -c -o $< $@

This needs to be ${cross_prefix}windres

MinGW's windres doesn't have a "-c" option.

Quoted 9 lines
Quoted 7 lines
(quoted diff) +2 -0
+if test "$mingw32" = "yes" ; then
+echo "#define QEMU_FILEVERSION $(tr . , < $source_path/VERSION),0" >>

$config_h
+echo "#define QEMU_PRODUCTVERSION $(tr . , < $source_path/VERSION),0"

Quoted 1 line
Quoted 1 line

$config_h

+fi

You could just use QEMU_VERSION in the .rc file

Instead of QEMU_FILEVERSION and QEMU_PRODUCTVERSION? No, because FILEVERSION numbers must be in format "a, b, c, d".

Quoted 2 lines

I think it's a good idea to include a default .rc file for the QEMU Windows build. If you update the patch, I'd be happy to apply it.

I'll apply it adjusted to my QEMU 0.9.1 sources and see if it's fine.

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#10 lore raw
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
(quoted diff) +2 -0
+if test "$mingw32" = "yes" ; then
+echo "#define QEMU_FILEVERSION $(tr . , < $source_path/VERSION),0" >>

$config_h
+echo "#define QEMU_PRODUCTVERSION $(tr . , < $source_path/VERSION),0"

Quoted 2 lines
Quoted 2 lines

$config_h

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

+fi

You could just use QEMU_VERSION in the .rc file

Instead of QEMU_FILEVERSION and QEMU_PRODUCTVERSION? No, because FILEVERSION numbers must be in format "a, b, c, d".

Okay, I didn't know that.

Regards,

Anthony Liguori

#11 lore raw
Quoted 5 lines · Anthony Liguori
Quoted 3 lines

Instead of QEMU_FILEVERSION and QEMU_PRODUCTVERSION? No, because FILEVERSION numbers must be in format "a, b, c, d".

Okay, I didn't know that.

No problem. :-)

Btw: What's the difference betweeen VL_OBJS and OBJS in Makefile.target? I added "OBJS+=version.o" to the 0.9.1 Makefile.target, but it isn't linked in to the final EXE. If I delete version.o and version.rc, it doesn't even complain about not finding these files.

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#12 lore raw
Quoted 10 lines · Robert Riebisch
Quoted 6 lines · Anthony Liguori
Quoted 4 lines

Instead of QEMU_FILEVERSION and QEMU_PRODUCTVERSION? No, because FILEVERSION numbers must be in format "a, b, c, d".

Okay, I didn't know that.

Quoted 7 lines

No problem. :-)

Btw: What's the difference betweeen VL_OBJS and OBJS in Makefile.target? I added "OBJS+=version.o" to the 0.9.1 Makefile.target, but it isn't linked in to the final EXE. If I delete version.o and version.rc, it doesn't even complain about not finding these files.

VL_OBJS no longer exists in SVN so I can't really answer that.

Regards,

Anthony Liguori

Quoted 2 lines

Robert Riebisch

#13 lore raw
Quoted 1 line · Anthony Liguori

VL_OBJS no longer exists in SVN so I can't really answer that.

Oh, sorry. I thought, you're a long-term QEMU developer. :-)

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#14 lore raw
Quoted 8 lines · Robert Riebisch
Quoted 2 lines · Anthony Liguori

VL_OBJS no longer exists in SVN so I can't really answer that.

Oh, sorry. I thought, you're a long-term QEMU developer. :-)

I have a short term memory. I would have to look at the 0.9.1 source code to figure out the difference which presumably you could also do :-)

Regards,

Anthony Liguori

Quoted 2 lines

Robert Riebisch

#15 lore raw
Quoted 8 lines · Anthony Liguori
Quoted 5 lines
Quoted 2 lines

VL_OBJS no longer exists in SVN so I can't really answer that.

Oh, sorry. I thought, you're a long-term QEMU developer. :-)

I have a short term memory. I would have to look at the 0.9.1 source code to figure out the difference which presumably you could also do :-)

I did, of course, but still have no idea what "VL" stands for.

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#16 lore raw
In reply to Robert Riebisch
Quoted 4 lines · Robert Riebisch

Btw: What's the difference betweeen VL_OBJS and OBJS in Makefile.target? I added "OBJS+=version.o" to the 0.9.1 Makefile.target, but it isn't linked in to the final EXE. If I delete version.o and version.rc, it doesn't even complain about not finding these files.

Catched. In 0.9.1 $(QEMU_SYSTEM) depends on $(VL_OBJS), not $(OBJS).

$(QEMU_SYSTEM): $(VL_OBJS) ../libqemu_common.a libqemu.a

	$(CC) $(VL_LDFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) $(SDL_LIBS)

$(COCOA_LIBS) $(VL_LIBS)

Adding version.o to VL_OBJS gives "No rule to make target version.c', needed by version.o'.". Probably because of:

vldepend: $(VL_OBJS:.o=.c)

	$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(BASE_CFLAGS) $^ 1>.depend

So I'll introduce RES_OBJS in my private build only, because QEMU SVN is very different.

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#18 lore raw
Quoted 1 line · Consul

How about adding an icon to the rc?

I'm working on that for my private build of QEMU 0.9.1. Don't know, if it helps for SVN, but I would share my experiences, if it's done.

Quoted 2 lines

I have a possible one at
http://aleksoft.net/qemu.ico

No comment. :-]

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/
#19 lore raw
Quoted 9 lines · Robert Riebisch
Quoted 2 lines · Consul

How about adding an icon to the rc?

I'm working on that for my private build of QEMU 0.9.1. Don't know, if it helps for SVN, but I would share my experiences, if it's done.

If we had an icon, sure. But we don't and I'm not artistically inclined. Picking out an icon that everyone likes is just going to be a hassle. Since we don't have much of a GUI today, I just don't see it being worth it.

Maybe down the road if someone submits a nice GUI for QEMU :-)

Regards,

Anthony Liguori

Quoted 8 lines
Quoted 3 lines

I have a possible one at
http://aleksoft.net/qemu.ico

No comment. :-]

Robert Riebisch

#20 lore raw
In reply to Anthony Liguori
Quoted 5 lines · Anthony Liguori

Makefile.target line 686

Quoted 5 lines

%.o: %.c

     $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
Makefile.target +3 -0
+
+%.o: %.rc
+    windres -I. -DORIGINAL_FILENAME=\"$(QEMU_PROG)\" -c -o $< $@

I think, this should read "-o $@ $<" for windres too?!

Robert Riebisch

Signature · 2 lines
BTTR Software
http://www.bttr-software.de/