makefiles: Unify APPMODE and EXTRADLLFLAGS variables.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-04-09 10:13:37 +02:00
parent 5edcae420a
commit 1d6a410244
6 changed files with 20 additions and 18 deletions

View File

@ -1,4 +1,4 @@
MODULE = rundll.exe16 MODULE = rundll.exe16
APPMODE = -m16 APPMODE = -mconsole -m16
C_SRCS = rundll.c C_SRCS = rundll.c

View File

@ -1,5 +1,5 @@
MODULE = svchost.exe MODULE = svchost.exe
APPMODE = -municode APPMODE = -mconsole -municode
IMPORTS = advapi32 IMPORTS = advapi32
C_SRCS = \ C_SRCS = \

View File

@ -1,4 +1,4 @@
MODULE = winhelp.exe16 MODULE = winhelp.exe16
APPMODE = -m16 APPMODE = -mconsole -m16
C_SRCS = winhelp.c C_SRCS = winhelp.c

View File

@ -1,4 +1,4 @@
MODULE = winoldap.mod16 MODULE = winoldap.mod16
APPMODE = -m16 APPMODE = -mconsole -m16
C_SRCS = winoldap.c C_SRCS = winoldap.c

View File

@ -445,6 +445,7 @@ sub update_makefiles(@)
if ($file =~ /^programs\//) if ($file =~ /^programs\//)
{ {
die "APPMODE should be defined in $file" unless defined $make{"APPMODE"} ; die "APPMODE should be defined in $file" unless defined $make{"APPMODE"} ;
die "APPMODE should contain -mconsole or -mwindows in $file" unless $make{"APPMODE"} =~ /-m(console|windows)/;
die "Invalid MODULE in $file" unless $name =~ /\./ || $make{"MODULE"} eq "$name.exe"; die "Invalid MODULE in $file" unless $name =~ /\./ || $make{"MODULE"} eq "$name.exe";
} }
else else

View File

@ -170,7 +170,6 @@ struct makefile
struct strarray define_args; struct strarray define_args;
struct strarray programs; struct strarray programs;
struct strarray scripts; struct strarray scripts;
struct strarray appmode;
struct strarray imports; struct strarray imports;
struct strarray subdirs; struct strarray subdirs;
struct strarray delayimports; struct strarray delayimports;
@ -195,6 +194,7 @@ struct makefile
int disabled; int disabled;
int use_msvcrt; int use_msvcrt;
int is_win16; int is_win16;
int is_exe;
struct makefile **submakes; struct makefile **submakes;
/* values generated at output time */ /* values generated at output time */
@ -2143,11 +2143,11 @@ static struct strarray get_default_imports( const struct makefile *make )
struct strarray ret = empty_strarray; struct strarray ret = empty_strarray;
if (strarray_exists( &make->extradllflags, "-nodefaultlibs" )) return ret; if (strarray_exists( &make->extradllflags, "-nodefaultlibs" )) return ret;
if (strarray_exists( &make->appmode, "-mno-cygwin" )) strarray_add( &ret, "msvcrt" ); if (strarray_exists( &make->extradllflags, "-mno-cygwin" )) strarray_add( &ret, "msvcrt" );
strarray_add( &ret, "winecrt0" );
if (make->is_win16) strarray_add( &ret, "kernel" ); if (make->is_win16) strarray_add( &ret, "kernel" );
strarray_add( &ret, "kernel32" ); strarray_add( &ret, "kernel32" );
strarray_add( &ret, "ntdll" ); strarray_add( &ret, "ntdll" );
strarray_add( &ret, "winecrt0" );
return ret; return ret;
} }
@ -3070,8 +3070,7 @@ static void output_module( struct makefile *make )
char *spec_file = NULL; char *spec_file = NULL;
unsigned int i; unsigned int i;
if (!make->appmode.count) if (!make->is_exe) spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, 0 )); strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, 0 ));
strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->imports, 0 )); strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->imports, 0 ));
add_import_libs( make, &dep_libs, get_default_imports( make ), 0 ); /* dependencies only */ add_import_libs( make, &dep_libs, get_default_imports( make ), 0 ); /* dependencies only */
@ -3106,10 +3105,10 @@ static void output_module( struct makefile *make )
output_winegcc_command( make, 0 ); output_winegcc_command( make, 0 );
if (spec_file) if (spec_file)
{ {
output( " -shared %s", spec_file ); output_filename( "-shared" );
output_filenames( make->extradllflags ); output_filename( spec_file );
} }
else output_filenames( make->appmode ); output_filenames( make->extradllflags );
output_filenames_obj_dir( make, make->object_files ); output_filenames_obj_dir( make, make->object_files );
output_filenames_obj_dir( make, make->res_files ); output_filenames_obj_dir( make, make->res_files );
output_filenames( all_libs ); output_filenames( all_libs );
@ -3257,7 +3256,7 @@ static void output_test_module( struct makefile *make )
strarray_add( &make->clean_files, strmake( "%s%s", stripped, ext )); strarray_add( &make->clean_files, strmake( "%s%s", stripped, ext ));
output( "%s%s:\n", obj_dir_path( make, testmodule ), ext ); output( "%s%s:\n", obj_dir_path( make, testmodule ), ext );
output_winegcc_command( make, !!crosstarget ); output_winegcc_command( make, !!crosstarget );
output_filenames( make->appmode ); output_filenames( make->extradllflags );
output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files );
output_filenames_obj_dir( make, make->res_files ); output_filenames_obj_dir( make, make->res_files );
output_filenames( all_libs ); output_filenames( all_libs );
@ -3267,7 +3266,7 @@ static void output_test_module( struct makefile *make )
output_winegcc_command( make, !!crosstarget ); output_winegcc_command( make, !!crosstarget );
output_filename( "-s" ); output_filename( "-s" );
output_filename( strmake( "-Wb,-F,%s", testmodule )); output_filename( strmake( "-Wb,-F,%s", testmodule ));
output_filenames( make->appmode ); output_filenames( make->extradllflags );
output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files ); output_filenames_obj_dir( make, crosstarget ? make->crossobj_files : make->object_files );
output_filenames_obj_dir( make, make->res_files ); output_filenames_obj_dir( make, make->res_files );
output_filenames( all_libs ); output_filenames( all_libs );
@ -3469,7 +3468,7 @@ static void output_subdirs( struct makefile *make )
if (!submake->staticlib) if (!submake->staticlib)
{ {
strarray_add( &builddeps_deps, subdir ); strarray_add( &builddeps_deps, subdir );
if (!submake->appmode.count) if (!submake->is_exe)
{ {
output( "manpages htmlpages sgmlpages xmlpages::\n" ); output( "manpages htmlpages sgmlpages xmlpages::\n" );
output( "\t@cd %s && $(MAKE) $@\n", subdir ); output( "\t@cd %s && $(MAKE) $@\n", subdir );
@ -3977,7 +3976,6 @@ static void load_sources( struct makefile *make )
make->programs = get_expanded_make_var_array( make, "PROGRAMS" ); make->programs = get_expanded_make_var_array( make, "PROGRAMS" );
make->scripts = get_expanded_make_var_array( make, "SCRIPTS" ); make->scripts = get_expanded_make_var_array( make, "SCRIPTS" );
make->appmode = get_expanded_make_var_array( make, "APPMODE" );
make->imports = get_expanded_make_var_array( make, "IMPORTS" ); make->imports = get_expanded_make_var_array( make, "IMPORTS" );
make->delayimports = get_expanded_make_var_array( make, "DELAYIMPORTS" ); make->delayimports = get_expanded_make_var_array( make, "DELAYIMPORTS" );
make->extradllflags = get_expanded_make_var_array( make, "EXTRADLLFLAGS" ); make->extradllflags = get_expanded_make_var_array( make, "EXTRADLLFLAGS" );
@ -3987,9 +3985,12 @@ static void load_sources( struct makefile *make )
if (make->module && strendswith( make->module, ".a" )) make->staticlib = make->module; if (make->module && strendswith( make->module, ".a" )) make->staticlib = make->module;
strarray_addall( &make->extradllflags, get_expanded_make_var_array( make, "APPMODE" ));
make->disabled = make->base_dir && strarray_exists( &disabled_dirs, make->base_dir ); make->disabled = make->base_dir && strarray_exists( &disabled_dirs, make->base_dir );
make->is_win16 = strarray_exists( &make->extradllflags, "-m16" ) || strarray_exists( &make->appmode, "-m16" ); make->is_win16 = strarray_exists( &make->extradllflags, "-m16" );
make->use_msvcrt = strarray_exists( &make->appmode, "-mno-cygwin" ); make->use_msvcrt = strarray_exists( &make->extradllflags, "-mno-cygwin" );
make->is_exe = strarray_exists( &make->extradllflags, "-mconsole" ) ||
strarray_exists( &make->extradllflags, "-mwindows" );
for (i = 0; i < make->imports.count && !make->use_msvcrt; i++) for (i = 0; i < make->imports.count && !make->use_msvcrt; i++)
make->use_msvcrt = !strncmp( make->imports.str[i], "msvcr", 5 ) || make->use_msvcrt = !strncmp( make->imports.str[i], "msvcr", 5 ) ||