1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
commit 0621c02215d3c78552d05be27bfcd33335512b2c
Author: Alexandre Julliard <julliard@winehq.org>
Date: Thu Feb 27 11:01:12 2025 +0100
makefiles: Add support for assembly source files.
diff --git a/tools/make_makefiles b/tools/make_makefiles
index 646a70d18f4..ad9494e983e 100755
--- a/tools/make_makefiles
+++ b/tools/make_makefiles
@@ -298,7 +298,7 @@ sub assign_sources_to_makefiles(@)
{
next unless $dir eq "dlls/winewayland.drv";
}
- elsif ($name !~ /\.(c|in|inl|l|m|mc|po|rc|rh|sfd|svg|x|y)$/)
+ elsif ($name !~ /\.(S|c|in|inl|l|m|mc|po|rc|rh|sfd|svg|x|y)$/)
{
next unless $dir eq "loader"; # loader dir contains misc files
}
diff --git a/tools/makedep.c b/tools/makedep.c
index c339753596e..5610f85c93f 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -606,6 +606,25 @@ static int is_native_arch_disabled( struct makefile *make )
}
+/*******************************************************************
+ * is_subdir_other_arch
+ *
+ * Check if the filename is in a subdirectory named from a different arch.
+ * Used to avoid building asm files for the wrong platform.
+ */
+static int is_subdir_other_arch( const char *name, unsigned int arch )
+{
+ const char *dir, *p = strrchr( name, '/' );
+
+ if (!p || p == name) return 0;
+ dir = get_basename( strmake( "%.*s", (int)(p - name), name ));
+ if (!strcmp( dir, "arm64" )) dir = "aarch64";
+ if (!strcmp( dir, "amd64" )) dir = "x86_64";
+ if (native_archs[arch] && !strcmp( dir, archs.str[native_archs[arch]] )) return 0;
+ return strcmp( dir, archs.str[arch] );
+}
+
+
/*******************************************************************
* get_link_arch
*/
@@ -3223,6 +3242,8 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou
if (!(source->file->flags & FLAG_C_IMPLIB) && (!make->staticlib || make->extlib)) return;
}
+ if (strendswith( source->name, ".S" ) && is_subdir_other_arch( source->name, arch )) return;
+
obj_name = strmake( "%s%s.o", source->arch ? "" : arch_dirs[arch], obj );
strarray_add( targets, obj_name );
@@ -3599,6 +3620,7 @@ static void output_static_lib( struct makefile *make, unsigned int arch )
const char *name = strmake( "%s%s", arch_dirs[arch], make->staticlib );
unsigned int hybrid_arch = hybrid_archs[arch];
+ if (make->disabled[arch]) return;
if (native_archs[arch]) return;
strarray_add( &make->clean_files, name );
|