From 1d6a4102444f0f2dfd9f131ad4dc9811343cbd0d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 9 Apr 2019 10:13:37 +0200 Subject: [PATCH] makefiles: Unify APPMODE and EXTRADLLFLAGS variables. Signed-off-by: Alexandre Julliard --- programs/rundll.exe16/Makefile.in | 2 +- programs/svchost/Makefile.in | 2 +- programs/winhelp.exe16/Makefile.in | 2 +- programs/winoldap.mod16/Makefile.in | 2 +- tools/make_makefiles | 1 + tools/makedep.c | 29 +++++++++++++++-------------- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/programs/rundll.exe16/Makefile.in b/programs/rundll.exe16/Makefile.in index fe08104830f..4ea0fe97fef 100644 --- a/programs/rundll.exe16/Makefile.in +++ b/programs/rundll.exe16/Makefile.in @@ -1,4 +1,4 @@ MODULE = rundll.exe16 -APPMODE = -m16 +APPMODE = -mconsole -m16 C_SRCS = rundll.c diff --git a/programs/svchost/Makefile.in b/programs/svchost/Makefile.in index b24af3b7aa5..0cbf5bee215 100644 --- a/programs/svchost/Makefile.in +++ b/programs/svchost/Makefile.in @@ -1,5 +1,5 @@ MODULE = svchost.exe -APPMODE = -municode +APPMODE = -mconsole -municode IMPORTS = advapi32 C_SRCS = \ diff --git a/programs/winhelp.exe16/Makefile.in b/programs/winhelp.exe16/Makefile.in index ad1695bed42..a9deacb11d0 100644 --- a/programs/winhelp.exe16/Makefile.in +++ b/programs/winhelp.exe16/Makefile.in @@ -1,4 +1,4 @@ MODULE = winhelp.exe16 -APPMODE = -m16 +APPMODE = -mconsole -m16 C_SRCS = winhelp.c diff --git a/programs/winoldap.mod16/Makefile.in b/programs/winoldap.mod16/Makefile.in index cedf37838db..01fbf78efee 100644 --- a/programs/winoldap.mod16/Makefile.in +++ b/programs/winoldap.mod16/Makefile.in @@ -1,4 +1,4 @@ MODULE = winoldap.mod16 -APPMODE = -m16 +APPMODE = -mconsole -m16 C_SRCS = winoldap.c diff --git a/tools/make_makefiles b/tools/make_makefiles index 455ff9e9641..3936310b8d5 100755 --- a/tools/make_makefiles +++ b/tools/make_makefiles @@ -445,6 +445,7 @@ sub update_makefiles(@) if ($file =~ /^programs\//) { 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"; } else diff --git a/tools/makedep.c b/tools/makedep.c index 20fec7ff62c..227d5896dc4 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -170,7 +170,6 @@ struct makefile struct strarray define_args; struct strarray programs; struct strarray scripts; - struct strarray appmode; struct strarray imports; struct strarray subdirs; struct strarray delayimports; @@ -195,6 +194,7 @@ struct makefile int disabled; int use_msvcrt; int is_win16; + int is_exe; struct makefile **submakes; /* values generated at output time */ @@ -2143,11 +2143,11 @@ static struct strarray get_default_imports( const struct makefile *make ) struct strarray ret = empty_strarray; 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" ); strarray_add( &ret, "kernel32" ); strarray_add( &ret, "ntdll" ); - strarray_add( &ret, "winecrt0" ); return ret; } @@ -3070,8 +3070,7 @@ static void output_module( struct makefile *make ) char *spec_file = NULL; unsigned int i; - if (!make->appmode.count) - spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" )); + if (!make->is_exe) 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->imports, 0 )); 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 ); if (spec_file) { - output( " -shared %s", spec_file ); - output_filenames( make->extradllflags ); + output_filename( "-shared" ); + 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->res_files ); 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 )); output( "%s%s:\n", obj_dir_path( make, testmodule ), ext ); 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, make->res_files ); output_filenames( all_libs ); @@ -3267,7 +3266,7 @@ static void output_test_module( struct makefile *make ) output_winegcc_command( make, !!crosstarget ); output_filename( "-s" ); 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, make->res_files ); output_filenames( all_libs ); @@ -3469,7 +3468,7 @@ static void output_subdirs( struct makefile *make ) if (!submake->staticlib) { strarray_add( &builddeps_deps, subdir ); - if (!submake->appmode.count) + if (!submake->is_exe) { output( "manpages htmlpages sgmlpages xmlpages::\n" ); 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->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->delayimports = get_expanded_make_var_array( make, "DELAYIMPORTS" ); 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; + strarray_addall( &make->extradllflags, get_expanded_make_var_array( make, "APPMODE" )); 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->use_msvcrt = strarray_exists( &make->appmode, "-mno-cygwin" ); + make->is_win16 = strarray_exists( &make->extradllflags, "-m16" ); + 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++) make->use_msvcrt = !strncmp( make->imports.str[i], "msvcr", 5 ) ||