Script to compile Wine programs on Windows

Richard Cohen richard.cohen at virgin.net
Wed Sep 24 08:43:53 CDT 2003


Pavel Roskin wrote:
> 
> I have looked at winegcc source and it seems it will greatly improve
> portability.  I think it's a good idea to switch to winegcc first.

Provided you don't care about delay-loading libraries, you can already 
compile the programs with winegcc. Here's the patch

--
Richard
-------------- next part --------------
diff -u -r programs/Makeprog.rules.in programs/Makeprog.rules.in
--- programs/Makeprog.rules.in	2003-06-17 08:10:37.000000000 +0100
+++ programs/Makeprog.rules.in	2003-09-24 14:31:34.000000000 +0100
@@ -19,25 +19,24 @@
 
 @MAKE_RULES@
 
-all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
+all: $(MODULE)$(DLLEXT)
 
 # Rule for main module spec file
+APPTYPE1=$(APPMODE:%gui=windows) 
+APPTYPE=$(APPTYPE1:%cui=console)
+# where we can find winegcc, winewrap, winebuild
+TOOLSPATH=$(TOOLSDIR)/tools/winegcc:$(TOOLSDIR)/tools/winebuild
+WINEGCC=PATH=$(TOOLSPATH):$(PATH) winegcc
 
-$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
-	$(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=--exe-mode %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
+.c.o : 
+	$(WINEGCC) $(ALLCFLAGS) -o $@ -c $<
 
 # Rules for .so main module
 
-$(MODULE).so: $(MODULE).spec.o $(ALL_OBJS) Makefile.in
-	$(LDSHARED) $(LDDLLFLAGS) $(MODULE).spec.o $(ALL_OBJS) -o $@ $(ALL_LIBS) -lc
-
-$(BASEMODULE): $(WINEWRAPPER)
-	$(RM) $@ && $(LN_S) $(WINEWRAPPER) $@
-
-# Rules for .exe main module
-
-$(MODULE): $(ALL_OBJS) $(RCOBJS) Makefile.in
-	$(CC) $(ALL_OBJS) $(RCOBJS) -o $@ $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%) $(ALL_LIBS)
+$(MODULE).so: $(ALL_OBJS) $(RC_SRCS:.rc=.res) Makefile.in $(WINEWRAPPER)
+	$(RM) $(BASEMODULE)
+	$(WINEGCC) -m$(APPTYPE) $(ALLCFLAGS) $(ALL_OBJS) $(RC_SRCS:.rc=.res) -o $(MODULE) -L$(DLLDIR) -L$(LIBDIR) $(EXTRALIBS) $(LIBPORT) -Wl $(LDFLAGS) $(DELAYIMPORTS:%=-l%) $(IMPORTS:%=-l%)
+	$(RM) $(BASEMODULE) && $(LN_S) $(WINEWRAPPER) $(BASEMODULE)
 
 # Rules for testing
 


More information about the wine-devel mailing list