Module: wine Branch: master Commit: 6fb5e4d99acfe6fb6c660484e2c008f823409409 URL: https://gitlab.winehq.org/wine/wine/-/commit/6fb5e4d99acfe6fb6c660484e2c008f...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Oct 25 11:08:56 2022 +0200
makedep: Add support for architecture-specific IDL objects.
---
tools/makedep.c | 88 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 28 deletions(-)
diff --git a/tools/makedep.c b/tools/makedep.c index c7a9199fcf6..a6e053646db 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -115,7 +115,6 @@ static const struct { FLAG_IDL_PROXY, "_p.c" }, { FLAG_IDL_SERVER, "_s.c" }, { FLAG_IDL_REGISTER, "_r.res" }, - { FLAG_IDL_HEADER, ".h" } };
#define HASH_SIZE 197 @@ -2770,20 +2769,15 @@ static void output_source_res( struct makefile *make, struct incl_file *source, static void output_source_idl( struct makefile *make, struct incl_file *source, const char *obj ) { struct strarray defines = get_source_defines( make, source, obj ); - struct strarray targets = empty_strarray; - char *dest; - unsigned int i; + struct strarray headers = empty_strarray; + struct strarray multiarch_targets[MAX_ARCHS] = { empty_strarray }; + const char *dest; + unsigned int i, arch; + int multiarch;
if (find_include_file( make, strmake( "%s.h", obj ))) source->file->flags |= FLAG_IDL_HEADER; if (!source->file->flags) return;
- for (i = 0; i < ARRAY_SIZE(idl_outputs); i++) - { - if (!(source->file->flags & idl_outputs[i].flag)) continue; - dest = strmake( "%s%s", obj, idl_outputs[i].ext ); - if (!find_src_file( make, dest )) strarray_add( &make->clean_files, dest ); - strarray_add( &targets, dest ); - } if (source->file->flags & FLAG_IDL_PROXY) strarray_add( &make->dlldata_files, source->name ); if (source->file->flags & FLAG_INSTALL) { @@ -2793,28 +2787,66 @@ static void output_source_idl( struct makefile *make, struct incl_file *source, add_install_rule( make, source->name, strmake( "%s.h", obj ), strmake( "d$(includedir)/wine/%s.h", get_include_install_path( obj ) )); } - if (!targets.count) return; + if (source->file->flags & FLAG_IDL_HEADER) + { + dest = strmake( "%s.h", obj ); + strarray_add( &headers, dest ); + if (!find_src_file( make, dest )) strarray_add( &make->clean_files, dest ); + }
- output_filenames_obj_dir( make, targets ); - output( ": %s\n", tools_path( make, "widl" )); - output( "\t%s%s -o $@", cmd_prefix( "WIDL" ), tools_path( make, "widl" ) ); - output_filenames( target_flags[0] ); - output_filename( "--nostdinc" ); - output_filename( "-Ldlls/\*" ); - output_filenames( defines ); - output_filenames( get_expanded_make_var_array( make, "EXTRAIDLFLAGS" )); - output_filenames( get_expanded_file_local_var( make, obj, "EXTRAIDLFLAGS" )); + for (i = 0; i < ARRAY_SIZE(idl_outputs); i++) + { + if (!(source->file->flags & idl_outputs[i].flag)) continue; + multiarch = (make->use_msvcrt && archs.count > 1); + for (arch = 0; arch < archs.count; arch++) + { + if (!arch != !multiarch) continue; + dest = strmake( "%s%s", obj, idl_outputs[i].ext ); + if (!find_src_file( make, dest )) strarray_add( &make->clean_files, dest ); + strarray_add( &multiarch_targets[arch], dest ); + } + } + + for (arch = 0; arch < archs.count; arch++) + { + if (multiarch_targets[arch].count + (arch ? 0 : headers.count) == 0) continue; + if (!arch) output_filenames_obj_dir( make, headers ); + output_filenames_obj_dir( make, multiarch_targets[arch] ); + output( ":\n" ); + output( "\t%s%s -o $@", cmd_prefix( "WIDL" ), tools_path( make, "widl" ) ); + output_filenames( target_flags[arch] ); + output_filename( "--nostdinc" ); + output_filename( "-Ldlls/\*" ); + output_filenames( defines ); + output_filenames( get_expanded_make_var_array( make, "EXTRAIDLFLAGS" )); + output_filenames( get_expanded_file_local_var( make, obj, "EXTRAIDLFLAGS" )); + output_filename( source->filename ); + output( "\n" ); + } + + output_filenames_obj_dir( make, headers ); + for (arch = 0; arch < archs.count; arch++) output_filenames_obj_dir( make, multiarch_targets[arch] ); + output( ":" ); + output_filename( tools_path( make, "widl" )); output_filename( source->filename ); - output( "\n" ); - output_filenames_obj_dir( make, targets ); - output( ": %s", source->filename ); output_filenames( source->dependencies ); - for (i = 0; i < source->importlibdeps.count; i++) + output( "\n" ); + + if (source->importlibdeps.count) { - struct makefile *submake = find_importlib_module( source->importlibdeps.str[i] ); - output_filename( obj_dir_path( submake, submake->module )); + for (arch = 0; arch < archs.count; arch++) + { + if (!multiarch_targets[arch].count) continue; + output_filenames_obj_dir( make, multiarch_targets[arch] ); + output( ":" ); + for (i = 0; i < source->importlibdeps.count; i++) + { + struct makefile *submake = find_importlib_module( source->importlibdeps.str[i] ); + output_filename( obj_dir_path( submake, submake->module )); + } + output( "\n" ); + } } - output( "\n" ); }