diff --git a/dlls/combase/tests/wine.combase.test.c b/dlls/combase/tests/wine.combase.test.c index e6171c6c6e7..3106a61b648 100644 --- a/dlls/combase/tests/wine.combase.test.c +++ b/dlls/combase/tests/wine.combase.test.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stddef.h> diff --git a/dlls/dinput/tests/driver_bus.c b/dlls/dinput/tests/driver_bus.c index 44a14798337..c0d181c58a5 100644 --- a/dlls/dinput/tests/driver_bus.c +++ b/dlls/dinput/tests/driver_bus.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/dinput/tests/driver_hid.c b/dlls/dinput/tests/driver_hid.c index 8f015eb5ddf..5c1bda6871e 100644 --- a/dlls/dinput/tests/driver_hid.c +++ b/dlls/dinput/tests/driver_hid.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/dinput/tests/driver_hid_poll.c b/dlls/dinput/tests/driver_hid_poll.c index b5cf46f389e..aad1c6ee0e6 100644 --- a/dlls/dinput/tests/driver_hid_poll.c +++ b/dlls/dinput/tests/driver_hid_poll.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/imagehlp/tests/testdll.c b/dlls/imagehlp/tests/testdll.c index 3c079bfffd3..58e852b268d 100644 --- a/dlls/imagehlp/tests/testdll.c +++ b/dlls/imagehlp/tests/testdll.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <oaidl.h> #include <commdlg.h> #include <shlwapi.h> diff --git a/dlls/imm32/tests/ime_wrapper.c b/dlls/imm32/tests/ime_wrapper.c index d8a03499549..8d5eb498809 100644 --- a/dlls/imm32/tests/ime_wrapper.c +++ b/dlls/imm32/tests/ime_wrapper.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include "ime_test.h" struct ime_functions ime_functions = {0}; diff --git a/dlls/kernel32/tests/dummy.c b/dlls/kernel32/tests/dummy.c index b8eab8c219e..4837a3736ba 100644 --- a/dlls/kernel32/tests/dummy.c +++ b/dlls/kernel32/tests/dummy.c @@ -1,3 +1,25 @@ +/* + * Copyright 2019 Fabian Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep testdll +#endif + #include <windows.h> static HINSTANCE instance; diff --git a/dlls/msi/tests/custom.c b/dlls/msi/tests/custom.c index 30b9040acff..ef24de5cc22 100644 --- a/dlls/msi/tests/custom.c +++ b/dlls/msi/tests/custom.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/msi/tests/selfreg.c b/dlls/msi/tests/selfreg.c index 668e742e9ba..2f5e6f48ef1 100644 --- a/dlls/msi/tests/selfreg.c +++ b/dlls/msi/tests/selfreg.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <windef.h> #include <winbase.h> diff --git a/dlls/ntoskrnl.exe/tests/driver.c b/dlls/ntoskrnl.exe/tests/driver.c index bd388a6ec9e..5275aada3dc 100644 --- a/dlls/ntoskrnl.exe/tests/driver.c +++ b/dlls/ntoskrnl.exe/tests/driver.c @@ -20,6 +20,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/ntoskrnl.exe/tests/driver2.c b/dlls/ntoskrnl.exe/tests/driver2.c index c648ec60ffc..56260d711df 100644 --- a/dlls/ntoskrnl.exe/tests/driver2.c +++ b/dlls/ntoskrnl.exe/tests/driver2.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include "ntstatus.h" diff --git a/dlls/ntoskrnl.exe/tests/driver3.c b/dlls/ntoskrnl.exe/tests/driver3.c index a7737a960a0..917a1dbec6b 100644 --- a/dlls/ntoskrnl.exe/tests/driver3.c +++ b/dlls/ntoskrnl.exe/tests/driver3.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include "ntstatus.h" diff --git a/dlls/ntoskrnl.exe/tests/driver_netio.c b/dlls/ntoskrnl.exe/tests/driver_netio.c index 9f9478d75b0..365c90a05ab 100644 --- a/dlls/ntoskrnl.exe/tests/driver_netio.c +++ b/dlls/ntoskrnl.exe/tests/driver_netio.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/ntoskrnl.exe/tests/driver_pnp.c b/dlls/ntoskrnl.exe/tests/driver_pnp.c index 77332708fd3..f66d56de8c7 100644 --- a/dlls/ntoskrnl.exe/tests/driver_pnp.c +++ b/dlls/ntoskrnl.exe/tests/driver_pnp.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include <stdio.h> diff --git a/dlls/ole32/tests/testlib.c b/dlls/ole32/tests/testlib.c index 9631f81c9c3..0d5c915d12f 100644 --- a/dlls/ole32/tests/testlib.c +++ b/dlls/ole32/tests/testlib.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdio.h> #include <windows.h> #include <initguid.h> diff --git a/dlls/setupapi/tests/coinst.c b/dlls/setupapi/tests/coinst.c index ba526a5d3a1..82597b7bc54 100644 --- a/dlls/setupapi/tests/coinst.c +++ b/dlls/setupapi/tests/coinst.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <stdarg.h> #include "windef.h" #include "winbase.h" diff --git a/dlls/setupapi/tests/selfreg.c b/dlls/setupapi/tests/selfreg.c index f687990f3bc..3e45d661483 100644 --- a/dlls/setupapi/tests/selfreg.c +++ b/dlls/setupapi/tests/selfreg.c @@ -18,6 +18,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #define COBJMACROS #include "msxml.h" diff --git a/dlls/ucrtbase/tests/threaddll.c b/dlls/ucrtbase/tests/threaddll.c index 72b8074054a..387a00bff03 100644 --- a/dlls/ucrtbase/tests/threaddll.c +++ b/dlls/ucrtbase/tests/threaddll.c @@ -16,6 +16,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#if 0 +#pragma makedep testdll +#endif + #include <windows.h> #include "threaddll.h" diff --git a/tools/makedep.c b/tools/makedep.c index d3064ea4ff1..9d2f6317ece 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -87,6 +87,7 @@ struct incl_file #define FLAG_GENERATED 0x000001 /* generated file */ #define FLAG_INSTALL 0x000002 /* file to install */ +#define FLAG_TESTDLL 0x000004 /* file is part of a TESTDLL resource */ #define FLAG_IDL_PROXY 0x000100 /* generates a proxy (_p.c) file */ #define FLAG_IDL_CLIENT 0x000200 /* generates a client (_c.c) file */ #define FLAG_IDL_SERVER 0x000400 /* generates a server (_s.c) file */ @@ -928,6 +929,7 @@ static void parse_pragma_directive( struct file *source, char *str ) return; } else if (!strcmp( flag, "install" )) source->flags |= FLAG_INSTALL; + else if (!strcmp( flag, "testdll" )) source->flags |= FLAG_TESTDLL; if (strendswith( source->name, ".idl" )) { @@ -2731,7 +2733,7 @@ static void output_source_rc( struct makefile *make, struct incl_file *source, c if (source->file->flags & FLAG_RC_HEADER) return; if (source->file->flags & FLAG_GENERATED) strarray_add( &make->clean_files, source->name ); if (linguas.count && (source->file->flags & FLAG_RC_PO)) po_dir = "po"; - if (!make->testdll || !find_src_file( make, strmake( "%s.spec", obj ) )) /* RC is for a TESTDLL */ + if (!(source->file->flags & FLAG_TESTDLL)) { for (arch = 0; arch < archs.count; arch++) if (!make->disabled[arch]) strarray_add( &make->res_files[arch], res_file ); @@ -3061,12 +3063,22 @@ static void output_source_in( struct makefile *make, struct incl_file *source, c * output_source_spec */ static void output_source_spec( struct makefile *make, struct incl_file *source, const char *obj ) +{ + /* nothing to do */ +} + + +/******************************************************************* + * output_source_testdll + */ +static void output_source_testdll( struct makefile *make, struct incl_file *source, const char *obj ) { struct strarray imports = get_expanded_file_local_var( make, obj, "IMPORTS" ); struct strarray dll_flags = empty_strarray; struct strarray default_imports = empty_strarray; struct strarray all_libs, dep_libs; const char *dll_name, *obj_name, *res_name, *output_rsrc, *output_file, *debug_file; + struct incl_file *spec_file = find_src_file( make, strmake( "%.spec", obj )); unsigned int arch; if (!imports.count) imports = make->imports; @@ -3074,6 +3086,8 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, strarray_addall( &dll_flags, get_expanded_file_local_var( make, obj, "EXTRADLLFLAGS" )); if (!strarray_exists( &dll_flags, "-nodefaultlibs" )) default_imports = get_default_imports( make, imports ); + if (!spec_file) fatal_error( "testdll source %s needs a .spec file\n", source->name ); + for (arch = 0; arch < archs.count; arch++) { if (!is_multiarch( arch )) continue; @@ -3099,7 +3113,7 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, tools_path( make, "wrc" )); output( "%s:", output_file ); - output_filename( source->filename ); + output_filename( spec_file->filename ); output_filename( obj_name ); if (res_name) output_filename( res_name ); output_filenames( dep_libs ); @@ -3111,7 +3125,7 @@ static void output_source_spec( struct makefile *make, struct incl_file *source, output_filenames( dll_flags ); if (arch) output_filenames( get_expanded_arch_var_array( make, "EXTRADLLFLAGS", arch )); output_filename( "-shared" ); - output_filename( source->filename ); + output_filename( spec_file->filename ); output_filename( obj_name ); if (res_name) output_filename( res_name ); if ((debug_file = get_debug_file( make, dll_name, arch ))) @@ -3143,7 +3157,7 @@ static void output_source_xml( struct makefile *make, struct incl_file *source, */ static void output_source_one_arch( struct makefile *make, struct incl_file *source, const char *obj, struct strarray defines, struct strarray *targets, - unsigned int arch, int is_dll_src ) + unsigned int arch ) { const char *obj_name; @@ -3171,7 +3185,7 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou strarray_add( &make->unixobj_files, obj_name ); else if (source->file->flags & FLAG_C_IMPLIB) strarray_add( &make->implib_files[arch], obj_name ); - else if (!is_dll_src) + else if (!(source->file->flags & FLAG_TESTDLL)) strarray_add( &make->object_files[arch], obj_name ); else strarray_add( &make->clean_files, obj_name ); @@ -3204,8 +3218,8 @@ static void output_source_one_arch( struct makefile *make, struct incl_file *sou output_filename( arch_make_variable( "CFLAGS", arch )); output( "\n" ); - if (make->testdll && !is_dll_src && strendswith( source->name, ".c" ) && - !(source->file->flags & FLAG_GENERATED)) + if (make->testdll && strendswith( source->name, ".c" ) && + !(source->file->flags & (FLAG_GENERATED | FLAG_TESTDLL))) { const char *ok_file, *test_exe; @@ -3228,22 +3242,24 @@ static void output_source_default( struct makefile *make, struct incl_file *sour { struct strarray defines = get_source_defines( make, source, obj ); struct strarray targets = empty_strarray; - int is_dll_src = (make->testdll && strendswith( source->name, ".c" ) && - find_src_file( make, replace_extension( source->name, ".c", ".spec" ))); unsigned int arch; for (arch = 0; arch < archs.count; arch++) if (!source->arch || source->arch == arch) - output_source_one_arch( make, source, obj, defines, &targets, arch, is_dll_src ); + output_source_one_arch( make, source, obj, defines, &targets, arch ); if (source->file->flags & FLAG_GENERATED) { if (!make->testdll || !strendswith( source->filename, "testlist.c" )) strarray_add( &make->clean_files, source->basename ); } + else if (source->file->flags & FLAG_TESTDLL) + { + output_source_testdll( make, source, obj ); + } else { - if (make->testdll && !is_dll_src && strendswith( source->name, ".c" )) + if (make->testdll && strendswith( source->name, ".c" )) strarray_add( &make->test_files, obj ); }