Commit 1cd2786f authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Generate cross-compile rules automatically when supported.

parent 0ae7b5ff
...@@ -16533,11 +16533,6 @@ $as_echo_n "creating Makefile rules..." >&6 ...@@ -16533,11 +16533,6 @@ $as_echo_n "creating Makefile rules..." >&6
MAKE_IMPLIB_RULES="DLLFLAGS = $DLLFLAGS MAKE_IMPLIB_RULES="DLLFLAGS = $DLLFLAGS
" "
if test -n "$CROSSTARGET"
then
as_fn_append MAKE_IMPLIB_RULES "MAKEDEPFLAGS = -xo -xcross.o
"
fi
MAKE_DLL_RULES=" MAKE_DLL_RULES="
...@@ -16556,12 +16551,6 @@ DLLFLAGS = $DLLFLAGS ...@@ -16556,12 +16551,6 @@ DLLFLAGS = $DLLFLAGS
RUNTESTFLAGS = -q -P wine RUNTESTFLAGS = -q -P wine
" "
if test -n "$CROSSTARGET"
then
as_fn_append MAKE_TEST_RULES "
MAKEDEPFLAGS = -xo -xcross.o
"
fi
wine_fn_append_rule " wine_fn_append_rule "
......
...@@ -2595,11 +2595,6 @@ dnl Import library rules ...@@ -2595,11 +2595,6 @@ dnl Import library rules
AC_SUBST(MAKE_IMPLIB_RULES,"DLLFLAGS = $DLLFLAGS 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 dnl Dll and program rules
...@@ -2617,12 +2612,6 @@ AC_SUBST(MAKE_TEST_RULES," ...@@ -2617,12 +2612,6 @@ AC_SUBST(MAKE_TEST_RULES,"
DLLFLAGS = $DLLFLAGS DLLFLAGS = $DLLFLAGS
RUNTESTFLAGS = -q -P wine RUNTESTFLAGS = -q -P wine
") ")
if test -n "$CROSSTARGET"
then
AS_VAR_APPEND([MAKE_TEST_RULES],"
MAKEDEPFLAGS = -xo -xcross.o
")
fi
dnl Main makefile dnl Main makefile
......
STATICLIB = libadsiid.a MODULE = libadsiid.a
C_SRCS = \ C_SRCS = \
adsiid.c adsiid.c
......
STATICLIB = libdxerr8.a MODULE = libdxerr8.a
C_SRCS = \ C_SRCS = \
dxerr8.c dxerr8.c
......
STATICLIB = libdxerr9.a MODULE = libdxerr9.a
C_SRCS = \ C_SRCS = \
dxerr9.c dxerr9.c
......
STATICLIB = libdxguid.a MODULE = libdxguid.a
C_SRCS = \ C_SRCS = \
dx10guid.c \ dx10guid.c \
......
STATICLIB = libstrmbase.a MODULE = libstrmbase.a
C_SRCS = \ C_SRCS = \
audio.c \ audio.c \
......
STATICLIB = libstrmiids.a MODULE = libstrmiids.a
C_SRCS = \ C_SRCS = \
strmiids.c strmiids.c
......
STATICLIB = libuuid.a MODULE = libuuid.a
C_SRCS = \ C_SRCS = \
uuid.c uuid.c
......
STATICLIB = libwinecrt0.a MODULE = libwinecrt0.a
C_SRCS = \ C_SRCS = \
delay_load.c \ delay_load.c \
......
...@@ -93,7 +93,6 @@ struct strarray ...@@ -93,7 +93,6 @@ struct strarray
static const struct strarray empty_strarray; static const struct strarray empty_strarray;
static struct strarray include_args; static struct strarray include_args;
static struct strarray object_extensions;
static struct strarray make_vars; static struct strarray make_vars;
static struct strarray cmdline_vars; static struct strarray cmdline_vars;
...@@ -475,9 +474,6 @@ static void init_paths(void) ...@@ -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 )); 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 )); 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) ...@@ -1391,6 +1387,7 @@ static struct strarray output_sources(void)
char *crosstarget = get_expanded_make_variable( "CROSSTARGET" ); char *crosstarget = get_expanded_make_variable( "CROSSTARGET" );
if (exeext && !strcmp( exeext, ".exe" )) dllext = ""; if (exeext && !strcmp( exeext, ".exe" )) dllext = "";
if (module && strendswith( module, ".a" )) staticlib = module;
strarray_add( &includes, "-I." ); strarray_add( &includes, "-I." );
if (src_dir) strarray_add( &includes, strmake( "-I%s", src_dir )); if (src_dir) strarray_add( &includes, strmake( "-I%s", src_dir ));
...@@ -1573,29 +1570,17 @@ static struct strarray output_sources(void) ...@@ -1573,29 +1570,17 @@ static struct strarray output_sources(void)
} }
else 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_GENERATED) strarray_add( &clean_files, source->filename );
if (source->flags & FLAG_C_IMPLIB) strarray_add( &implib_objs, strmake( "%s.o", obj )); if (source->flags & FLAG_C_IMPLIB) strarray_add( &implib_objs, strmake( "%s.o", obj ));
for (i = 0; i < object_extensions.count; i++) strarray_add( &object_files, strmake( "%s.o", obj ));
{ output( "%s.o: %s\n", obj, sourcedep );
output( "%s.%s: %s\n", obj, object_extensions.str[i], sourcedep ); output( "\t$(CC) -c -o $@ %s", source->filename );
if (strstr( object_extensions.str[i], "cross" )) output_filenames( includes );
{ output_filename( "$(ALLCFLAGS)" );
strarray_add( &crossobj_files, strmake( "%s.%s", obj, object_extensions.str[i] )); output( "\n" );
output( "\t$(CROSSCC) -c -o $@ %s", source->filename ); if (crosstarget && need_cross)
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( &crossobj_files, strmake( "%s.cross.o", obj )); strarray_add( &crossobj_files, strmake( "%s.cross.o", obj ));
output( "%s.cross.o: %s\n", obj, sourcedep ); output( "%s.cross.o: %s\n", obj, sourcedep );
...@@ -1613,9 +1598,8 @@ static struct strarray output_sources(void) ...@@ -1613,9 +1598,8 @@ static struct strarray output_sources(void)
} }
if (!strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED)) if (!strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED))
strarray_add( &c2man_files, source->filename ); strarray_add( &c2man_files, source->filename );
for (i = 0; i < object_extensions.count; i++) output( "%s.o", obj );
output( "%s.%s ", obj, object_extensions.str[i] ); if (crosstarget && need_cross) output( " %s.cross.o", obj );
if (source->flags & FLAG_C_IMPLIB) output( "%s.cross.o", obj );
output( ":" ); output( ":" );
} }
free( obj ); free( obj );
...@@ -1660,7 +1644,7 @@ static struct strarray output_sources(void) ...@@ -1660,7 +1644,7 @@ static struct strarray output_sources(void)
output( "\n" ); output( "\n" );
} }
if (module) if (module && !staticlib)
{ {
int is_win16 = strendswith( module, "16" ); int is_win16 = strendswith( module, "16" );
char *importlib = get_expanded_make_variable( "IMPORTLIB" ); char *importlib = get_expanded_make_variable( "IMPORTLIB" );
...@@ -1802,7 +1786,7 @@ static struct strarray output_sources(void) ...@@ -1802,7 +1786,7 @@ static struct strarray output_sources(void)
output( "\t$(AR) $(ARFLAGS) $@" ); output( "\t$(AR) $(ARFLAGS) $@" );
output_filenames( object_files ); output_filenames( object_files );
output( "\n\t$(RANLIB) $@\n" ); output( "\n\t$(RANLIB) $@\n" );
if (crosstarget && object_extensions.count > 1) if (crosstarget && module)
{ {
char *name = replace_extension( staticlib, ".a", ".cross.a" ); char *name = replace_extension( staticlib, ".a", ".cross.a" );
...@@ -2076,12 +2060,6 @@ static void update_makefile( const char *path ) ...@@ -2076,12 +2060,6 @@ static void update_makefile( const char *path )
top_obj_dir = get_expanded_make_variable( "top_builddir" ); top_obj_dir = get_expanded_make_variable( "top_builddir" );
parent_dir = get_expanded_make_variable( "PARENTSRC" ); 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; include_args = empty_strarray;
value = get_expanded_make_var_array( "EXTRAINCL" ); value = get_expanded_make_var_array( "EXTRAINCL" );
for (i = 0; i < value.count; i++) for (i = 0; i < value.count; i++)
...@@ -2181,8 +2159,7 @@ static int parse_option( const char *opt ) ...@@ -2181,8 +2159,7 @@ static int parse_option( const char *opt )
else Separator = NULL; else Separator = NULL;
break; break;
case 'x': case 'x':
if (opt[2]) strarray_add( &object_extensions, xstrdup( opt + 2 )); break; /* ignored */
break;
default: default:
fprintf( stderr, "Unknown option '%s'\n%s", opt, Usage ); fprintf( stderr, "Unknown option '%s'\n%s", opt, Usage );
exit(1); exit(1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment