To compile resources you should use the Wine Resource Compiler, wrc for short, which produces a binary .res file. This resource file is then used by winebuild when compiling the spec file (see The Spec file).
Again the makefiles generated by winemaker take care of this for you. But if you were to write your own makefile you would put something like the following:
WRC=$(WINE_DIR)/tools/wrc/wrc WINELIB_FLAGS = -I$(WINE_DIR)/include -DWINELIB -D_REENTRANT WRCFLAGS = -r -L .SUFFIXES: .rc .res .rc.res: $(WRC) $(WRCFLAGS) $(WINELIB_FLAGS) -o $@ $<
There are two issues you are likely to encounter with resource files.
The first problem is with the C library headers. wrc does not know where these headers are located. So if an RC file, of a file it includes, references such a header you will get a 'file not found' error. Here are a few ways to deal with this:
The solution traditionally used by the Winelib headers is to
enclose the offending include statement in an
#ifndef RC_INVOKED statement where
RC_INVOKED is a macro name which is
automatically defined by wrc.
Alternately you can add one or more
to your wrc command so that it finds you system files. For
instance you may add -I/usr/include
-I/usr/lib/gcc-lib/i386-linux/2.95.2/include to cater
to both C and C++ headers. But this supposes that you know where
these header files reside which decreases the portability of your
makefiles to other platforms.
Or you could use the C/C++ compiler to perform the preprocessing. To do so, simply modify your makefile as follows:
.rc.res: $(CC) $(CC_OPTS) -DRC_INVOKED -E -x c $< | $(WRC) -N $(WRCFLAGS) $(WINELIB_FLAGS) -o $@
The second problem is that the headers may contain constructs that wrc fails to understand. A typical example is a function which return a const type. wrc expects a function to be two identifiers followed by an opening parenthesis. With the const this is three identifiers followed by a parenthesis and thus wrc is confused (note: it should in fact ignore all this like the windows resource compiler does). The current work-around is to enclose offending statement(s) in a #ifndef RC_INVOKED.
Using GIF files in resources is problematic. For best results, convert them to BMP and change your .res file.
If you use common controls/dialogs in your resource files, you will need to add #include <commctrl.h> after the #include <windows.h> line, so that wrc knows the values of control specific flags.