winegcc: add support for preprocessor

Dimitrie O. Paun dimi at intelliware.ca
Thu Sep 11 16:42:52 CDT 2003


Certain usage patterns simply can not be accomodate
by 'winegcc -E' (such as preprocessing of .rc files).

ChangeLog
    Dimitrie O. Paun <dpaun at rogers.com>
    Add support for masquarading as the C preprocessor.


Index: tools/winegcc/Makefile.in
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/Makefile.in,v
retrieving revision 1.1
diff -u -r1.1 Makefile.in
--- tools/winegcc/Makefile.in	11 Sep 2003 21:27:58 -0000	1.1
+++ tools/winegcc/Makefile.in	11 Sep 2003 21:37:51 -0000
@@ -28,8 +28,10 @@
 	$(INSTALL_PROGRAM) winegcc $(bindir)/winegcc
 	$(INSTALL_PROGRAM) winewrap $(bindir)/winewrap
 	cd $(bindir) && $(RM) wineg++ && $(LN_S) winegcc wineg++
+	cd $(bindir) && $(RM) winecpp && $(LN_S) winegcc winecpp
 
 uninstall::
-	$(RM) $(bindir)/winegcc $(bindir)/wineg++ $(bindir)/winewrap
+	$(RM) $(bindir)/winegcc $(bindir)/wineg++ \
+	      $(bindir)/winecpp $(bindir)/winewrap
 
 ### Dependencies:
Index: tools/winegcc/winegcc.c
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/winegcc.c,v
retrieving revision 1.1
diff -u -r1.1 winegcc.c
--- tools/winegcc/winegcc.c	11 Sep 2003 21:27:58 -0000	1.1
+++ tools/winegcc/winegcc.c	11 Sep 2003 18:39:13 -0000
@@ -150,12 +150,13 @@
 {
     char **gcc_argv;
     int i, j;
-    int linking = 1, cpp = 0, use_static_linking = 0;
+    int linking = 1, cpp = 0, preprocessor = 0, use_static_linking = 0;
     int use_stdinc = 1, use_stdlib = 1, use_msvcrt = 0, gui_app = 0;
 
     atexit(clean_temp_files);
     
-    if (strendswith(argv[0], "++")) cpp = 1;
+    if (strendswith(argv[0], "winecpp")) preprocessor = 1;
+    else if (strendswith(argv[0], "++")) cpp = 1;
     
     for ( i = 1 ; i < argc ; i++ ) 
     {
@@ -208,6 +209,7 @@
         } 
     }
 
+    if (preprocessor) linking = 0;
     if (use_static_linking) error("Static linking is not supported.");
 
     gcc_argv = malloc(sizeof(char*) * (argc + 20));
@@ -283,10 +285,13 @@
     }
     else
     {
-	gcc_argv[i++] = cpp ? "g++" : "gcc";
+	gcc_argv[i++] = preprocessor ? "cpp" : cpp ? "g++" : "gcc";
 
-	gcc_argv[i++] = "-fshort-wchar";
-	gcc_argv[i++] = "-fPIC";
+	if (!preprocessor)
+	{
+	    gcc_argv[i++] = "-fshort-wchar";
+	    gcc_argv[i++] = "-fPIC";
+	}
 	if (use_stdinc)
 	{
 	    if (use_msvcrt)

-- 
Dimi.




More information about the wine-patches mailing list