From: Martin Storsjo Subject: [PATCH v2 02/10] makedep: Convert dashes to underscores in module names. Message-Id: <1418030820-20609-2-git-send-email-martin@martin.st> Date: Mon, 8 Dec 2014 11:26:52 +0200 This allows building tests for the api-ms-win-core-* DLLs. --- tools/makedep.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/makedep.c b/tools/makedep.c index 54aab45..7ddd703 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -483,6 +483,19 @@ static char *replace_extension( const char *name, const char *old_ext, const cha /******************************************************************* + * sanitize + */ +static void sanitize( char *buf ) +{ + while (*buf) { + if (*buf == '-') + *buf = '_'; + buf++; + } +} + + +/******************************************************************* * strarray_replace_extension */ static struct strarray strarray_replace_extension( const struct strarray *array, @@ -2018,11 +2031,15 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t } if (make->testdll && !strcmp( ext, "c" ) && !(source->file->flags & FLAG_GENERATED)) { + char *testname = xstrdup( make->testdll ); + sanitize( testname ); + strarray_add( &ok_files, strmake( "%s.ok", obj )); output( "%s.ok:\n", obj_dir_path( make, obj )); output( "\t%s $(RUNTESTFLAGS) -T %s -M %s -p %s%s %s && touch $@\n", top_dir_path( make, "tools/runtest" ), top_obj_dir_path( make, "" ), make->testdll, - replace_extension( make->testdll, ".dll", "_test.exe" ), dll_ext, obj ); + replace_extension( testname, ".dll", "_test.exe" ), dll_ext, obj ); + free( testname ); } if (!strcmp( ext, "c" ) && !(source->file->flags & FLAG_GENERATED)) strarray_add( &c2man_files, source->filename ); @@ -2249,6 +2266,7 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t char *testres = replace_extension( make->testdll, ".dll", "_test.res" ); struct strarray all_libs = empty_strarray; + sanitize(testmodule); for (i = 0; i < make->imports.count; i++) strarray_add( &all_libs, strmake( "-l%s", make->imports.str[i] )); strarray_addall( &all_libs, get_expanded_make_var_array( make, "LIBS" )); -- 1.8.1.2