Alexandre Julliard : makefiles: Generate cross-compile rules automatically when supported.

Alexandre Julliard julliard at winehq.org
Thu Jan 2 13:13:47 CST 2014


Module: wine
Branch: master
Commit: 1cd2786f926eb8904c7d5601519269f9d75c6943
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=1cd2786f926eb8904c7d5601519269f9d75c6943

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jan  1 21:27:22 2014 +0100

makefiles: Generate cross-compile rules automatically when supported.

---

 configure                 |   11 ---------
 configure.ac              |   11 ---------
 dlls/adsiid/Makefile.in   |    2 +-
 dlls/dxerr8/Makefile.in   |    2 +-
 dlls/dxerr9/Makefile.in   |    2 +-
 dlls/dxguid/Makefile.in   |    2 +-
 dlls/strmbase/Makefile.in |    2 +-
 dlls/strmiids/Makefile.in |    2 +-
 dlls/uuid/Makefile.in     |    2 +-
 dlls/winecrt0/Makefile.in |    2 +-
 tools/makedep.c           |   53 ++++++++++++--------------------------------
 11 files changed, 23 insertions(+), 68 deletions(-)

diff --git a/configure b/configure
index 71ff42b..c0eff26 100755
--- a/configure
+++ b/configure
@@ -16533,11 +16533,6 @@ $as_echo_n "creating Makefile rules..." >&6
 MAKE_IMPLIB_RULES="DLLFLAGS = $DLLFLAGS
 "
 
-if test -n "$CROSSTARGET"
-then
-    as_fn_append MAKE_IMPLIB_RULES "MAKEDEPFLAGS = -xo -xcross.o
-"
-fi
 
 
 MAKE_DLL_RULES="
@@ -16556,12 +16551,6 @@ DLLFLAGS     = $DLLFLAGS
 RUNTESTFLAGS = -q -P wine
 "
 
-if test -n "$CROSSTARGET"
-then
-    as_fn_append MAKE_TEST_RULES "
-MAKEDEPFLAGS    = -xo -xcross.o
-"
-fi
 
 
 wine_fn_append_rule "
diff --git a/configure.ac b/configure.ac
index bbae5b0..801527d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2595,11 +2595,6 @@ dnl Import library rules
 
 AC_SUBST(MAKE_IMPLIB_RULES,"DLLFLAGS = $DLLFLAGS
 ")
-if test -n "$CROSSTARGET"
-then
-    AS_VAR_APPEND([MAKE_IMPLIB_RULES],"MAKEDEPFLAGS = -xo -xcross.o
-")
-fi
 
 dnl Dll and program rules
 
@@ -2617,12 +2612,6 @@ AC_SUBST(MAKE_TEST_RULES,"
 DLLFLAGS     = $DLLFLAGS
 RUNTESTFLAGS = -q -P wine
 ")
-if test -n "$CROSSTARGET"
-then
-    AS_VAR_APPEND([MAKE_TEST_RULES],"
-MAKEDEPFLAGS    = -xo -xcross.o
-")
-fi
 
 dnl Main makefile
 
diff --git a/dlls/adsiid/Makefile.in b/dlls/adsiid/Makefile.in
index 221f19a..a5b27d5 100644
--- a/dlls/adsiid/Makefile.in
+++ b/dlls/adsiid/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libadsiid.a
+MODULE    = libadsiid.a
 
 C_SRCS = \
 	adsiid.c
diff --git a/dlls/dxerr8/Makefile.in b/dlls/dxerr8/Makefile.in
index dbd9b02..aa46a26 100644
--- a/dlls/dxerr8/Makefile.in
+++ b/dlls/dxerr8/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libdxerr8.a
+MODULE    = libdxerr8.a
 
 C_SRCS = \
 	dxerr8.c
diff --git a/dlls/dxerr9/Makefile.in b/dlls/dxerr9/Makefile.in
index c85f648..57edb14 100644
--- a/dlls/dxerr9/Makefile.in
+++ b/dlls/dxerr9/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libdxerr9.a
+MODULE    = libdxerr9.a
 
 C_SRCS = \
 	dxerr9.c
diff --git a/dlls/dxguid/Makefile.in b/dlls/dxguid/Makefile.in
index 261e0d0..a47a51f 100644
--- a/dlls/dxguid/Makefile.in
+++ b/dlls/dxguid/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libdxguid.a
+MODULE    = libdxguid.a
 
 C_SRCS = \
 	dx10guid.c \
diff --git a/dlls/strmbase/Makefile.in b/dlls/strmbase/Makefile.in
index 473cbdd..3ac7c56 100644
--- a/dlls/strmbase/Makefile.in
+++ b/dlls/strmbase/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libstrmbase.a
+MODULE    = libstrmbase.a
 
 C_SRCS = \
 	audio.c \
diff --git a/dlls/strmiids/Makefile.in b/dlls/strmiids/Makefile.in
index 3ed9247..744682e 100644
--- a/dlls/strmiids/Makefile.in
+++ b/dlls/strmiids/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libstrmiids.a
+MODULE    = libstrmiids.a
 
 C_SRCS = \
 	strmiids.c
diff --git a/dlls/uuid/Makefile.in b/dlls/uuid/Makefile.in
index 904c354..bc35e69 100644
--- a/dlls/uuid/Makefile.in
+++ b/dlls/uuid/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libuuid.a
+MODULE    = libuuid.a
 
 C_SRCS = \
 	uuid.c
diff --git a/dlls/winecrt0/Makefile.in b/dlls/winecrt0/Makefile.in
index 99cd65f..23dca02 100644
--- a/dlls/winecrt0/Makefile.in
+++ b/dlls/winecrt0/Makefile.in
@@ -1,4 +1,4 @@
-STATICLIB = libwinecrt0.a
+MODULE    = libwinecrt0.a
 
 C_SRCS = \
 	delay_load.c \
diff --git a/tools/makedep.c b/tools/makedep.c
index fba15ed..c84cc59 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -93,7 +93,6 @@ struct strarray
 static const struct strarray empty_strarray;
 
 static struct strarray include_args;
-static struct strarray object_extensions;
 static struct strarray make_vars;
 static struct strarray cmdline_vars;
 
@@ -475,9 +474,6 @@ static void init_paths(void)
 
     if (top_src_dir) strarray_insert( &include_args, 0, strmake( "-I%s/include", top_src_dir ));
     else if (top_obj_dir) strarray_insert( &include_args, 0, strmake( "-I%s/include", top_obj_dir ));
-
-    /* set the default extension list for object files */
-    if (!object_extensions.count) strarray_add( &object_extensions, "o" );
 }
 
 
@@ -1391,6 +1387,7 @@ static struct strarray output_sources(void)
     char *crosstarget = get_expanded_make_variable( "CROSSTARGET" );
 
     if (exeext && !strcmp( exeext, ".exe" )) dllext = "";
+    if (module && strendswith( module, ".a" )) staticlib = module;
 
     strarray_add( &includes, "-I." );
     if (src_dir) strarray_add( &includes, strmake( "-I%s", src_dir ));
@@ -1573,29 +1570,17 @@ static struct strarray output_sources(void)
         }
         else
         {
+            int need_cross = testdll || (source->flags & FLAG_C_IMPLIB) || (module && staticlib);
+
             if (source->flags & FLAG_GENERATED) strarray_add( &clean_files, source->filename );
             if (source->flags & FLAG_C_IMPLIB) strarray_add( &implib_objs, strmake( "%s.o", obj ));
-            for (i = 0; i < object_extensions.count; i++)
-            {
-                output( "%s.%s: %s\n", obj, object_extensions.str[i], sourcedep );
-                if (strstr( object_extensions.str[i], "cross" ))
-                {
-                    strarray_add( &crossobj_files, strmake( "%s.%s", obj, object_extensions.str[i] ));
-                    output( "\t$(CROSSCC) -c -o $@ %s", source->filename );
-                    output_filenames( includes );
-                    output_filename( "$(ALLCROSSCFLAGS)" );
-                    output( "\n" );
-                }
-                else
-                {
-                    strarray_add( &object_files, strmake( "%s.%s", obj, object_extensions.str[i] ));
-                    output( "\t$(CC) -c -o $@ %s", source->filename );
-                    output_filenames( includes );
-                    output_filename( "$(ALLCFLAGS)" );
-                    output( "\n" );
-                }
-            }
-            if (crosstarget && (source->flags & FLAG_C_IMPLIB))
+            strarray_add( &object_files, strmake( "%s.o", obj ));
+            output( "%s.o: %s\n", obj, sourcedep );
+            output( "\t$(CC) -c -o $@ %s", source->filename );
+            output_filenames( includes );
+            output_filename( "$(ALLCFLAGS)" );
+            output( "\n" );
+            if (crosstarget && need_cross)
             {
                 strarray_add( &crossobj_files, strmake( "%s.cross.o", obj ));
                 output( "%s.cross.o: %s\n", obj, sourcedep );
@@ -1613,9 +1598,8 @@ static struct strarray output_sources(void)
             }
             if (!strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED))
                 strarray_add( &c2man_files, source->filename );
-            for (i = 0; i < object_extensions.count; i++)
-                output( "%s.%s ", obj, object_extensions.str[i] );
-            if (source->flags & FLAG_C_IMPLIB) output( "%s.cross.o", obj );
+            output( "%s.o", obj );
+            if (crosstarget && need_cross) output( " %s.cross.o", obj );
             output( ":" );
         }
         free( obj );
@@ -1660,7 +1644,7 @@ static struct strarray output_sources(void)
         output( "\n" );
     }
 
-    if (module)
+    if (module && !staticlib)
     {
         int is_win16 = strendswith( module, "16" );
         char *importlib = get_expanded_make_variable( "IMPORTLIB" );
@@ -1802,7 +1786,7 @@ static struct strarray output_sources(void)
         output( "\t$(AR) $(ARFLAGS) $@" );
         output_filenames( object_files );
         output( "\n\t$(RANLIB) $@\n" );
-        if (crosstarget && object_extensions.count > 1)
+        if (crosstarget && module)
         {
             char *name = replace_extension( staticlib, ".a", ".cross.a" );
 
@@ -2076,12 +2060,6 @@ static void update_makefile( const char *path )
     top_obj_dir = get_expanded_make_variable( "top_builddir" );
     parent_dir  = get_expanded_make_variable( "PARENTSRC" );
 
-    object_extensions = empty_strarray;
-    value = get_expanded_make_var_array( "MAKEDEPFLAGS" );
-    for (i = 0; i < value.count; i++)
-        if (!strncmp( value.str[i], "-x", 2 ))
-            strarray_add( &object_extensions, value.str[i] + 2 );
-
     include_args = empty_strarray;
     value = get_expanded_make_var_array( "EXTRAINCL" );
     for (i = 0; i < value.count; i++)
@@ -2181,8 +2159,7 @@ static int parse_option( const char *opt )
         else Separator = NULL;
         break;
     case 'x':
-        if (opt[2]) strarray_add( &object_extensions, xstrdup( opt + 2 ));
-        break;
+        break;  /* ignored */
     default:
         fprintf( stderr, "Unknown option '%s'\n%s", opt, Usage );
         exit(1);




More information about the wine-cvs mailing list