diff --git a/tools/makedep.c b/tools/makedep.c index dfab52bf5fa..5f40a9302ea 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -129,6 +129,7 @@ struct makefile struct strarray extradllflags; const char *base_dir; const char *src_dir; + const char *obj_dir; const char *top_src_dir; const char *top_obj_dir; const char *parent_dir; @@ -542,12 +543,22 @@ static char *base_dir_path( const char *path ) } +/******************************************************************* + * obj_dir_path + */ +static char *obj_dir_path( const char *path ) +{ + return concat_paths( make->obj_dir, path ); +} + + /******************************************************************* * src_dir_path */ static char *src_dir_path( const char *path ) { - return concat_paths( make->src_dir, path ); + if (make->src_dir) return concat_paths( make->src_dir, path ); + return obj_dir_path( path ); } @@ -726,7 +737,7 @@ static struct incl_file *add_generated_source( const char *name, const char *fil file = xmalloc( sizeof(*file) ); memset( file, 0, sizeof(*file) ); file->name = xstrdup( name ); - file->filename = xstrdup( filename ? filename : name ); + file->filename = obj_dir_path( filename ? filename : name ); file->flags = FLAG_GENERATED; list_add_tail( &sources, &file->entry ); return file; @@ -782,7 +793,7 @@ static FILE *open_include_file( struct incl_file *pFile ) if ((file = open_file( filename ))) { pFile->sourcename = filename; - pFile->filename = xstrdup( pFile->name ); + pFile->filename = obj_dir_path( pFile->name ); /* don't bother to parse it */ fclose( file ); return NULL; @@ -798,7 +809,7 @@ static FILE *open_include_file( struct incl_file *pFile ) if ((file = open_file( filename ))) { pFile->sourcename = filename; - pFile->filename = xstrdup( pFile->name ); + pFile->filename = obj_dir_path( pFile->name ); return file; } free( filename ); @@ -1220,7 +1231,7 @@ static void parse_file( struct incl_file *source, int src ) /* don't try to open certain types of files */ if (strendswith( source->name, ".tlb" )) { - source->filename = xstrdup( source->name ); + source->filename = obj_dir_path( source->name ); return; } @@ -1491,6 +1502,17 @@ static void create_dir( const char *dir ) } +/******************************************************************* + * output_filenames_obj_dir + */ +static void output_filenames_obj_dir( struct strarray array ) +{ + unsigned int i; + + for (i = 0; i < array.count; i++) output_filename( obj_dir_path( array.str[i] )); +} + + /******************************************************************* * output_include */ @@ -1532,7 +1554,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) for (i = 0; i < linguas.count; i++) strarray_add( &mo_files, strmake( "%s/%s.mo", top_obj_dir_path( "po" ), linguas.str[i] )); - strarray_add( &includes, "-I." ); + strarray_add( &includes, strmake( "-I%s", obj_dir_path( "" ))); if (make->src_dir) strarray_add( &includes, strmake( "-I%s", make->src_dir )); if (make->parent_dir) strarray_add( &includes, strmake( "-I%s", src_dir_path( make->parent_dir ))); if (make->top_obj_dir) strarray_add( &includes, strmake( "-I%s", top_obj_dir_path( "include" ))); @@ -1565,35 +1587,35 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (find_include_file( header )) { - output( "%s.tab.h: %s\n", obj, source->filename ); + output( "%s: %s\n", obj_dir_path( header ), source->filename ); output( "\t$(BISON) -p %s_ -o %s.tab.c -d %s\n", - obj, obj, source->filename ); - output( "%s.tab.c: %s %s\n", obj, source->filename, header ); - strarray_add( &clean_files, strmake( "%s.tab.h", obj )); + obj, obj_dir_path( obj ), source->filename ); + output( "%s.tab.c: %s %s\n", obj_dir_path( obj ), source->filename, obj_dir_path( header )); + strarray_add( &clean_files, header ); } else output( "%s.tab.c: %s\n", obj, source->filename ); output( "\t$(BISON) -p %s_ -o $@ %s\n", obj, source->filename ); - free( header ); continue; /* no dependencies */ } else if (!strcmp( ext, "x" )) /* template file */ { - output( "%s.h: %s%s %s\n", obj, tools_dir_path( "make_xftmpl" ), tools_ext, source->filename ); + output( "%s.h: %s%s %s\n", obj_dir_path( obj ), + tools_dir_path( "make_xftmpl" ), tools_ext, source->filename ); output( "\t%s%s -H -o $@ %s\n", tools_dir_path( "make_xftmpl" ), tools_ext, source->filename ); strarray_add( &clean_files, strmake( "%s.h", obj )); continue; /* no dependencies */ } else if (!strcmp( ext, "l" )) /* lex file */ { - output( "%s.yy.c: %s\n", obj, source->filename ); + output( "%s.yy.c: %s\n", obj_dir_path( obj ), source->filename ); output( "\t$(FLEX) -o$@ %s\n", source->filename ); continue; /* no dependencies */ } else if (!strcmp( ext, "rc" )) /* resource file */ { strarray_add( &res_files, strmake( "%s.res", obj )); - output( "%s.res: %s %s\n", obj, tools_path( "wrc" ), source->filename ); + output( "%s.res: %s %s\n", obj_dir_path( obj ), tools_path( "wrc" ), source->filename ); output( "\t%s -o $@ %s", tools_path( "wrc" ), source->filename ); if (make->is_win16) output_filename( "-m16" ); else output_filenames( target_flags ); @@ -1606,31 +1628,31 @@ static struct strarray output_sources( struct strarray *testlist_files ) strarray_add( &po_files, source->filename ); output_filename( strmake( "--po-dir=%s", top_obj_dir_path( "po" ))); output( "\n" ); - output( "%s.res:", obj ); + output( "%s.res:", obj_dir_path( obj )); output_filenames( mo_files ); output( "\n" ); - output( "rsrc.pot " ); + output( "%s ", obj_dir_path( "rsrc.pot" )); } else output( "\n" ); - output( "%s.res:", obj ); + output( "%s.res:", obj_dir_path( obj )); } else if (!strcmp( ext, "mc" )) /* message file */ { strarray_add( &res_files, strmake( "%s.res", obj )); - output( "%s.res: %s %s\n", obj, tools_path( "wmc" ), source->filename ); + output( "%s.res: %s %s\n", obj_dir_path( obj ), tools_path( "wmc" ), source->filename ); output( "\t%s -U -O res -o $@ %s", tools_path( "wmc" ), source->filename ); if (mo_files.count) { strarray_add( &mc_files, source->filename ); output_filename( strmake( "--po-dir=%s", top_obj_dir_path( "po" ))); output( "\n" ); - output( "%s.res:", obj ); + output( "%s.res:", obj_dir_path( obj )); output_filenames( mo_files ); output( "\n" ); - output( "msg.pot " ); + output( "%s ", obj_dir_path( "msg.pot" )); } else output( "\n" ); - output( "%s.res:", obj ); + output( "%s.res:", obj_dir_path( obj )); } else if (!strcmp( ext, "idl" )) /* IDL file */ { @@ -1648,7 +1670,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) strarray_add( &targets, dest ); } if (source->flags & FLAG_IDL_PROXY) strarray_add( &dlldata_files, source->name ); - output_filenames( targets ); + output_filenames_obj_dir( targets ); output( ": %s\n", tools_path( "widl" )); output( "\t%s -o $@ %s", tools_path( "widl" ), source->filename ); output_filenames( target_flags ); @@ -1657,7 +1679,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) output_filenames( extradefs ); output_filenames( get_expanded_make_var_array( "EXTRAIDLFLAGS" )); output( "\n" ); - output_filenames( targets ); + output_filenames_obj_dir( targets ); output( ": %s", source->filename ); } else if (!strcmp( ext, "in" )) /* .in file or man page */ @@ -1673,8 +1695,8 @@ static struct strarray output_sources( struct strarray *testlist_files ) dir = strmake( "$(DESTDIR)$(mandir)/%s/man%s", lang, section ); } else dir = strmake( "$(DESTDIR)$(mandir)/man%s", section ); - output( "install-man-pages:: %s\n", obj ); - output( "\t$(INSTALL_DATA) %s %s/%s.%s\n", obj, dir, dest, section ); + output( "install-man-pages:: %s\n", obj_dir_path( obj )); + output( "\t$(INSTALL_DATA) %s %s/%s.%s\n", obj_dir_path( obj ), dir, dest, section ); output( "uninstall::\n" ); output( "\t$(RM) %s/%s.%s\n", dir, dest, section ); free( dest ); @@ -1684,9 +1706,9 @@ static struct strarray output_sources( struct strarray *testlist_files ) strarray_add_uniq( &phony_targets, "uninstall" ); } else strarray_add( &clean_files, xstrdup(obj) ); - output( "%s: %s\n", obj, source->filename ); + output( "%s: %s\n", obj_dir_path( obj ), source->filename ); output( "\t$(SED_CMD) %s >$@ || ($(RM) $@ && false)\n", source->filename ); - output( "%s:", obj ); + output( "%s:", obj_dir_path( obj )); } else if (!strcmp( ext, "sfd" )) /* font file */ { @@ -1714,11 +1736,11 @@ static struct strarray output_sources( struct strarray *testlist_files ) char *font = strtok( xstrdup(array->str[i]), " \t" ); char *args = strtok( NULL, "" ); - strarray_add( &all_targets, font ); - output( "%s: %s %s\n", font, tools_path( "sfnt2fon" ), ttf_file ); + strarray_add( &all_targets, xstrdup( font )); + output( "%s: %s %s\n", obj_dir_path( font ), tools_path( "sfnt2fon" ), ttf_file ); output( "\t%s -o $@ %s %s\n", tools_path( "sfnt2fon" ), ttf_file, args ); output( "install install-lib:: %s\n", font ); - output( "\t$(INSTALL_DATA) %s $(DESTDIR)$(fontdir)/%s\n", font, font ); + output( "\t$(INSTALL_DATA) %s $(DESTDIR)$(fontdir)/%s\n", obj_dir_path( font ), font ); output( "uninstall::\n" ); output( "\t$(RM) $(DESTDIR)$(fontdir)/%s\n", font ); } @@ -1735,7 +1757,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) { if (convert && rsvg && icotool && !make->src_dir) { - output( "%s.ico %s.bmp: %s\n", obj, obj, source->filename ); + output( "%s.ico %s.bmp: %s\n", src_dir_path(obj), src_dir_path(obj), source->filename ); output( "\tCONVERT=\"%s\" ICOTOOL=\"%s\" RSVG=\"%s\" %s %s $@\n", convert, icotool, rsvg, top_dir_path( "tools/buildimage" ), source->filename ); } @@ -1750,11 +1772,12 @@ static struct strarray output_sources( struct strarray *testlist_files ) { int need_cross = make->testdll || (source->flags & FLAG_C_IMPLIB) || (make->module && make->staticlib); - if ((source->flags & FLAG_GENERATED) && (!make->testdll || strcmp( source->filename, "testlist.c" ))) + if ((source->flags & FLAG_GENERATED) && + (!make->testdll || !strendswith( source->filename, "testlist.c" ))) strarray_add( &clean_files, source->filename ); if (source->flags & FLAG_C_IMPLIB) strarray_add( &implib_objs, strmake( "%s.o", obj )); strarray_add( &object_files, strmake( "%s.o", obj )); - output( "%s.o: %s\n", obj, source->filename ); + output( "%s.o: %s\n", obj_dir_path( obj ), source->filename ); output( "\t$(CC) -c -o $@ %s", source->filename ); output_filenames( includes ); output_filenames( make->define_args ); @@ -1771,7 +1794,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (crosstarget && need_cross) { strarray_add( &crossobj_files, strmake( "%s.cross.o", obj )); - output( "%s.cross.o: %s\n", obj, source->filename ); + output( "%s.cross.o: %s\n", obj_dir_path( obj ), source->filename ); output( "\t$(CROSSCC) -c -o $@ %s", source->filename ); output_filenames( includes ); output_filenames( make->define_args ); @@ -1784,15 +1807,15 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (make->testdll && !strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED)) { strarray_add( &ok_files, strmake( "%s.ok", obj )); - output( "%s.ok:\n", obj ); + output( "%s.ok:\n", obj_dir_path( obj )); output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", - top_dir_path( "tools/runtest" ), make->top_obj_dir, make->testdll, + top_dir_path( "tools/runtest" ), top_obj_dir_path( "" ), make->testdll, replace_extension( make->testdll, ".dll", "_test.exe" ), dll_ext, obj ); } if (!strcmp( ext, "c" ) && !(source->flags & FLAG_GENERATED)) strarray_add( &c2man_files, source->filename ); - output( "%s.o", obj ); - if (crosstarget && need_cross) output( " %s.cross.o", obj ); + output( "%s.o", obj_dir_path( obj )); + if (crosstarget && need_cross) output( " %s.cross.o", obj_dir_path( obj )); output( ":" ); } free( obj ); @@ -1805,7 +1828,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (po_files.count) { - output( "rsrc.pot: %s", tools_path( "wrc" ) ); + output( "%s: %s", obj_dir_path( "rsrc.pot" ), tools_path( "wrc" ) ); output_filenames( po_files ); output( "\n" ); output( "\t%s -O pot -o $@", tools_path( "wrc" )); @@ -1821,7 +1844,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (mc_files.count) { - output( "msg.pot: %s", tools_path( "wmc" )); + output( "%s: %s", obj_dir_path( "msg.pot" ), tools_path( "wmc" )); output_filenames( mc_files ); output( "\n" ); output( "\t%s -O pot -o $@", tools_path( "wmc" )); @@ -1832,7 +1855,8 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (dlldata_files.count) { - output( "dlldata.c: %s %s\n", tools_path( "widl" ), src_dir_path( "Makefile.in" )); + output( "%s: %s %s\n", obj_dir_path( "dlldata.c" ), + tools_path( "widl" ), src_dir_path( "Makefile.in" )); output( "\t%s --dlldata-only -o $@", tools_path( "widl" )); output_filenames( dlldata_files ); output( "\n" ); @@ -1841,6 +1865,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (make->module && !make->staticlib) { struct strarray all_libs = empty_strarray; + char *module_path = obj_dir_path( make->module ); char *spec_file = NULL; if (!make->appmode.count) spec_file = src_dir_path( replace_extension( make->module, ".dll", ".spec" )); @@ -1859,20 +1884,20 @@ static struct strarray output_sources( struct strarray *testlist_files ) { strarray_add( &all_targets, strmake( "%s%s", make->module, dll_ext )); strarray_add( &all_targets, strmake( "%s.fake", make->module )); - output( "%s%s %s.fake:", make->module, dll_ext, make->module ); + output( "%s%s %s.fake:", module_path, dll_ext, module_path ); } else { strarray_add( &all_targets, make->module ); - output( "%s:", make->module ); + output( "%s:", module_path ); } if (spec_file) output_filename( spec_file ); - output_filenames( object_files ); - output_filenames( res_files ); + output_filenames_obj_dir( object_files ); + output_filenames_obj_dir( res_files ); output( "\n" ); output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); - if (tools_dir) output_filename( strmake( "--sysroot=%s", make->top_obj_dir )); + if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( "" ))); output_filenames( target_flags ); output_filenames( unwind_flags ); if (spec_file) @@ -1881,18 +1906,19 @@ static struct strarray output_sources( struct strarray *testlist_files ) output_filenames( make->extradllflags ); } else output_filenames( make->appmode ); - output_filenames( object_files ); - output_filenames( res_files ); + output_filenames_obj_dir( object_files ); + output_filenames_obj_dir( res_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); if (spec_file && make->importlib) { + char *importlib_path = obj_dir_path( strmake( "lib%s", make->importlib )); if (*dll_ext) { strarray_add( &clean_files, strmake( "lib%s.def", make->importlib )); - output( "lib%s.def: %s %s\n", make->importlib, tools_path( "winebuild" ), spec_file ); + output( "%s.def: %s %s\n", importlib_path, tools_path( "winebuild" ), spec_file ); output( "\t%s -w --def -o $@ --export %s", tools_path( "winebuild" ), spec_file ); output_filenames( target_flags ); if (make->is_win16) output_filename( "-m16" ); @@ -1900,12 +1926,12 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (implib_objs.count) { strarray_add( &clean_files, strmake( "lib%s.def.a", make->importlib )); - output( "lib%s.def.a:", make->importlib ); - output_filenames( implib_objs ); + output( "%s.def.a:", importlib_path ); + output_filenames_obj_dir( implib_objs ); output( "\n" ); output( "\t$(RM) $@\n" ); output( "\t$(AR) $(ARFLAGS) $@" ); - output_filenames( implib_objs ); + output_filenames_obj_dir( implib_objs ); output( "\n" ); output( "\t$(RANLIB) $@\n" ); } @@ -1913,24 +1939,24 @@ static struct strarray output_sources( struct strarray *testlist_files ) else { strarray_add( &clean_files, strmake( "lib%s.a", make->importlib )); - output( "lib%s.a: %s %s", make->importlib, tools_path( "winebuild" ), spec_file ); - output_filenames( implib_objs ); + output( "%s.a: %s %s", importlib_path, tools_path( "winebuild" ), spec_file ); + output_filenames_obj_dir( implib_objs ); output( "\n" ); output( "\t%s -w --implib -o $@ --export %s", tools_path( "winebuild" ), spec_file ); output_filenames( target_flags ); - output_filenames( implib_objs ); + output_filenames_obj_dir( implib_objs ); output( "\n" ); } if (crosstarget && !make->is_win16) { struct strarray cross_files = strarray_replace_extension( &implib_objs, ".o", ".cross.o" ); strarray_add( &clean_files, strmake( "lib%s.cross.a", make->importlib )); - output( "lib%s.cross.a: %s %s", make->importlib, tools_path( "winebuild" ), spec_file ); - output_filenames( cross_files ); + output( "%s.cross.a: %s %s", importlib_path, tools_path( "winebuild" ), spec_file ); + output_filenames_obj_dir( cross_files ); output( "\n" ); output( "\t%s -b %s -w --implib -o $@ --export %s", tools_path( "winebuild" ), crosstarget, spec_file ); - output_filenames( cross_files ); + output_filenames_obj_dir( cross_files ); output( "\n" ); } } @@ -1979,22 +2005,22 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (make->staticlib) { strarray_add( &all_targets, make->staticlib ); - output( "%s:", make->staticlib ); - output_filenames( object_files ); + output( "%s:", obj_dir_path( make->staticlib )); + output_filenames_obj_dir( object_files ); output( "\n\t$(RM) $@\n" ); output( "\t$(AR) $(ARFLAGS) $@" ); - output_filenames( object_files ); + output_filenames_obj_dir( object_files ); output( "\n\t$(RANLIB) $@\n" ); if (crosstarget && make->module) { char *name = replace_extension( make->staticlib, ".a", ".cross.a" ); strarray_add( &all_targets, name ); - output( "%s:", name ); - output_filenames( crossobj_files ); + output( "%s:", obj_dir_path( name )); + output_filenames_obj_dir( crossobj_files ); output( "\n\t$(RM) $@\n" ); output( "\t%s-ar $(ARFLAGS) $@", crosstarget ); - output_filenames( crossobj_files ); + output_filenames_obj_dir( crossobj_files ); output( "\n\t%s-ranlib $@\n", crosstarget ); } } @@ -2003,6 +2029,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) { char *testmodule = replace_extension( make->testdll, ".dll", "_test.exe" ); char *stripped = replace_extension( make->testdll, ".dll", "_test-stripped.exe" ); + char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); struct strarray all_libs = empty_strarray; for (i = 0; i < make->imports.count; i++) @@ -2011,75 +2038,73 @@ static struct strarray output_sources( struct strarray *testlist_files ) strarray_add( &all_targets, strmake( "%s%s", testmodule, dll_ext )); strarray_add( &clean_files, strmake( "%s%s", stripped, dll_ext )); - output( "%s%s:\n", testmodule, dll_ext ); + output( "%s%s:\n", obj_dir_path( testmodule ), dll_ext ); output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); - if (tools_dir) output_filename( strmake( "--sysroot=%s", make->top_obj_dir )); + if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( "" ))); output_filenames( target_flags ); output_filenames( unwind_flags ); output_filenames( make->appmode ); - output_filenames( object_files ); - output_filenames( res_files ); + output_filenames_obj_dir( object_files ); + output_filenames_obj_dir( res_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s:\n", stripped, dll_ext ); + output( "%s%s:\n", obj_dir_path( stripped ), dll_ext ); output( "\t%s -o $@", tools_path( "winegcc" )); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); - if (tools_dir) output_filename( strmake( "--sysroot=%s", make->top_obj_dir )); + if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( "" ))); output_filenames( target_flags ); output_filenames( unwind_flags ); output_filename( strmake( "-Wb,-F,%s", testmodule )); output_filenames( make->appmode ); - output_filenames( object_files ); - output_filenames( res_files ); + output_filenames_obj_dir( object_files ); + output_filenames_obj_dir( res_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - output( "%s%s %s%s:", testmodule, dll_ext, stripped, dll_ext ); - output_filenames( object_files ); - output_filenames( res_files ); + output( "%s%s %s%s:", obj_dir_path( testmodule ), dll_ext, obj_dir_path( stripped ), dll_ext ); + output_filenames_obj_dir( object_files ); + output_filenames_obj_dir( res_files ); output( "\n" ); - if (make->top_obj_dir) - { - char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); - output( "all: %s/%s\n", top_obj_dir_path( "programs/winetest" ), testres ); - output( "%s/%s: %s%s\n", top_obj_dir_path( "programs/winetest" ), testres, stripped, dll_ext ); - output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n", - testmodule, stripped, dll_ext, tools_path( "wrc" )); - } + output( "all: %s/%s\n", top_obj_dir_path( "programs/winetest" ), testres ); + output( "%s/%s: %s%s\n", top_obj_dir_path( "programs/winetest" ), testres, + obj_dir_path( stripped ), dll_ext ); + output( "\techo \"%s TESTRES \\\"%s%s\\\"\" | %s -o $@\n", + testmodule, obj_dir_path( stripped ), dll_ext, tools_path( "wrc" )); if (crosstarget) { char *crosstest = replace_extension( make->testdll, ".dll", "_crosstest.exe" ); strarray_add( &clean_files, crosstest ); - output( "crosstest: %s\n", crosstest ); - output( "%s:", crosstest ); - output_filenames( crossobj_files ); - output_filenames( res_files ); + output( "%s: %s\n", obj_dir_path( "crosstest" ), obj_dir_path( crosstest )); + output( "%s:", obj_dir_path( crosstest )); + output_filenames_obj_dir( crossobj_files ); + output_filenames_obj_dir( res_files ); output( "\n" ); output( "\t%s -o $@ -b %s", tools_path( "winegcc" ), crosstarget ); output_filename( strmake( "-B%s", tools_dir_path( "winebuild" ))); - if (tools_dir) output_filename( strmake( "--sysroot=%s", make->top_obj_dir )); + if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( "" ))); output_filename( "--lib-suffix=.cross.a" ); - output_filenames( crossobj_files ); - output_filenames( res_files ); + output_filenames_obj_dir( crossobj_files ); + output_filenames_obj_dir( res_files ); output_filenames( all_libs ); output_filename( "$(LDFLAGS)" ); output( "\n" ); - strarray_add( &phony_targets, "crosstest" ); + strarray_add( &phony_targets, obj_dir_path( "crosstest" )); + if (make->obj_dir) output( "crosstest: %s\n", obj_dir_path( "crosstest" )); } - output_filenames( ok_files ); + output_filenames_obj_dir( ok_files ); output( ": %s%s ../%s%s\n", testmodule, dll_ext, make->testdll, dll_ext ); output( "check test:" ); - output_filenames( ok_files ); + output_filenames_obj_dir( ok_files ); output( "\n" ); output( "testclean::\n" ); output( "\t$(RM)" ); - output_filenames( ok_files ); + output_filenames_obj_dir( ok_files ); output( "\n" ); strarray_addall( &clean_files, ok_files ); strarray_add( &phony_targets, "check" ); @@ -2091,7 +2116,7 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (all_targets.count) { output( "all:" ); - output_filenames( all_targets ); + output_filenames_obj_dir( all_targets ); output( "\n" ); } @@ -2103,11 +2128,12 @@ static struct strarray output_sources( struct strarray *testlist_files ) if (clean_files.count) { - output( "clean::\n" ); + output( "%s::\n", obj_dir_path( "clean" )); output( "\t$(RM)" ); - output_filenames( clean_files ); + output_filenames_obj_dir( clean_files ); output( "\n" ); - strarray_add( &phony_targets, "clean" ); + if (make->obj_dir) output( "__clean__: %s\n", obj_dir_path( "clean" )); + strarray_add( &phony_targets, obj_dir_path( "clean" )); } if (make->top_obj_dir)