Alexandre Julliard : makefiles: Support cross-compilation of 16-bit libraries.

Alexandre Julliard julliard at winehq.org
Mon May 20 15:50:46 CDT 2019


Module: wine
Branch: master
Commit: c4e0b9d0925529faec050f023c669f7c58c1c5dc
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=c4e0b9d0925529faec050f023c669f7c58c1c5dc

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat May 18 09:22:26 2019 +0200

makefiles: Support cross-compilation of 16-bit libraries.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/winecrt0/exe16_entry.c |  2 +-
 tools/makedep.c             | 20 ++++++++++++++------
 tools/winegcc/winegcc.c     |  5 +----
 3 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/dlls/winecrt0/exe16_entry.c b/dlls/winecrt0/exe16_entry.c
index 1e477bd..e6823b2 100644
--- a/dlls/winecrt0/exe16_entry.c
+++ b/dlls/winecrt0/exe16_entry.c
@@ -18,7 +18,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
-#if defined(__i386__) && !defined(_WIN32)
+#ifdef __i386__
 
 #include <stdarg.h>
 #include "windef.h"
diff --git a/tools/makedep.c b/tools/makedep.c
index 7ed9efd..23b3389 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -3221,9 +3221,11 @@ static void output_module( struct makefile *make )
         {
             strarray_add( &make->clean_files, strmake( "lib%s.def", make->importlib ));
             output( "%s.def: %s %s\n", importlib_path, tools_path( make, "winebuild" ), spec_file );
-            output( "\t%s -w --def -o $@ --export %s", tools_path( make, "winebuild" ), spec_file );
+            output( "\t%s -w --def -o $@", tools_path( make, "winebuild" ) );
             output_filenames( target_flags );
             if (make->is_win16) output_filename( "-m16" );
+            output_filename( "--export" );
+            output_filename( spec_file );
             output( "\n" );
             add_install_rule( make, make->importlib,
                               strmake( "lib%s.def", make->importlib ),
@@ -3240,8 +3242,11 @@ static void output_module( struct makefile *make )
             output( "%s.a: %s %s", importlib_path, tools_path( make, "winebuild" ), spec_file );
             output_filenames_obj_dir( make, make->implib_objs );
             output( "\n" );
-            output( "\t%s -w --implib -o $@ --export %s", tools_path( make, "winebuild" ), spec_file );
+            output( "\t%s -w --implib -o $@", tools_path( make, "winebuild" ) );
             output_filenames( target_flags );
+            if (make->is_win16) output_filename( "-m16" );
+            output_filename( "--export" );
+            output_filename( spec_file );
             output_filenames_obj_dir( make, make->implib_objs );
             output( "\n" );
             add_install_rule( make, make->importlib,
@@ -3264,8 +3269,10 @@ static void output_module( struct makefile *make )
             output( ": %s %s", tools_path( make, "winebuild" ), spec_file );
             output_filenames_obj_dir( make, cross_files );
             output( "\n" );
-            output( "\t%s -b %s -w --implib -o $@ --export %s",
-                    tools_path( make, "winebuild" ), crosstarget, spec_file );
+            output( "\t%s -b %s -w --implib -o $@", tools_path( make, "winebuild" ), crosstarget );
+            if (make->is_win16) output_filename( "-m16" );
+            output_filename( "--export" );
+            output_filename( spec_file );
             output_filenames_obj_dir( make, cross_files );
             output( "\n" );
         }
@@ -3586,6 +3593,7 @@ static void output_subdirs( struct makefile *make )
                     output_filename( tools_path( make, "winebuild" ));
                     output( "\n" );
                     output( "\t%s -b %s -w -o $@", tools_path( make, "winebuild" ), crosstarget );
+                    if (submake->is_win16) output_filename( "-m16" );
                     output_filename( "--implib" );
                     output_filename( "--export" );
                     output_filename( spec_file );
@@ -4175,14 +4183,14 @@ static void load_sources( struct makefile *make )
     LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 );
     LIST_FOR_EACH_ENTRY( file, &make->sources, struct incl_file, entry ) get_dependencies( file, file );
 
-    if (crosstarget && !make->is_win16 && !strarray_exists( &make->imports, "kernel" ))
-        make->is_cross = (make->testdll || make->use_msvcrt || !has_object_file( make ));
+    if (crosstarget) make->is_cross = (make->testdll || make->use_msvcrt || !has_object_file( make ));
 
     if (make->is_cross)
     {
         for (i = 0; i < make->imports.count; i++)
             strarray_add_uniq( &cross_import_libs, make->imports.str[i] );
         if (make->use_msvcrt) strarray_add_uniq( &cross_import_libs, "msvcrt" );
+        if (make->is_win16) strarray_add_uniq( &cross_import_libs, "kernel" );
         strarray_add_uniq( &cross_import_libs, "winecrt0" );
         strarray_add_uniq( &cross_import_libs, "kernel32" );
         strarray_add_uniq( &cross_import_libs, "ntdll" );
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 28dce1b..242df38 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -429,7 +429,7 @@ static strarray *get_link_args( struct options *opts, const char *output_name )
 
     case PLATFORM_WINDOWS:
     case PLATFORM_CYGWIN:
-        if (opts->shared)
+        if (opts->shared || opts->win16_app)
         {
             strarray_add( flags, "-shared" );
             strarray_add( flags, "-Wl,--kill-at" );
@@ -999,9 +999,6 @@ static void build(struct options* opts)
 	    lang = file;
     }
 
-    if (opts->win16_app && is_pe)
-        error( "Building 16-bit code is not supported for Windows\n" );
-
     /* add the default libraries, if needed */
 
     if (!opts->wine_objdir && !opts->nodefaultlibs)




More information about the wine-cvs mailing list