wmc: Set the output format from the output file name.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
b7b44224d1
commit
8247686c10
|
@ -2757,11 +2757,15 @@ static void output_source_rc( struct makefile *make, struct incl_file *source, c
|
|||
static void output_source_mc( struct makefile *make, struct incl_file *source, const char *obj )
|
||||
{
|
||||
unsigned int i;
|
||||
char *obj_path = obj_dir_path( make, obj );
|
||||
|
||||
strarray_add( &make->res_files, strmake( "%s.res", obj ));
|
||||
strarray_add( &make->clean_files, strmake( "%s.pot", obj ));
|
||||
output( "%s.res: %s\n", obj_dir_path( make, obj ), source->filename );
|
||||
output( "\t%s -U -O res -o $@ %s", tools_path( make, "wmc" ), source->filename );
|
||||
output( "%s.pot %s.res: %s", obj_path, obj_path, source->filename );
|
||||
output_filename( tools_path( make, "wmc" ));
|
||||
output_filenames( source->dependencies );
|
||||
output( "\n" );
|
||||
output( "\t%s -u -o $@ %s", tools_path( make, "wmc" ), source->filename );
|
||||
if (linguas.count)
|
||||
{
|
||||
char *po_dir = top_obj_dir_path( make, "po" );
|
||||
|
@ -2772,13 +2776,6 @@ static void output_source_mc( struct makefile *make, struct incl_file *source, c
|
|||
output_filename( strmake( "%s/%s.mo", po_dir, linguas.str[i] ));
|
||||
}
|
||||
output( "\n" );
|
||||
output( "%s.pot: %s\n", obj_dir_path( make, obj ), source->filename );
|
||||
output( "\t%s -O pot -o $@ %s", tools_path( make, "wmc" ), source->filename );
|
||||
output( "\n" );
|
||||
output( "%s.pot %s.res:", obj_dir_path( make, obj ), obj_dir_path( make, obj ));
|
||||
output_filename( tools_path( make, "wmc" ));
|
||||
output_filenames( source->dependencies );
|
||||
output( "\n" );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -200,6 +200,13 @@ char *strmake( const char* fmt, ... )
|
|||
}
|
||||
}
|
||||
|
||||
int strendswith( const char *str, const char *end )
|
||||
{
|
||||
int l = strlen(str);
|
||||
int m = strlen(end);
|
||||
return l >= m && !strcmp( str + l - m, end );
|
||||
}
|
||||
|
||||
int unistrlen(const WCHAR *s)
|
||||
{
|
||||
int n;
|
||||
|
|
|
@ -43,6 +43,7 @@ void error(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
|||
void warning(const char *s, ...) __attribute__((format (printf, 1, 2)));
|
||||
|
||||
char *dup_basename(const char *name, const char *ext);
|
||||
int strendswith( const char *str, const char *end );
|
||||
|
||||
WCHAR *xunistrdup(const WCHAR * str);
|
||||
WCHAR *unistrcpy(WCHAR *dst, const WCHAR *src);
|
||||
|
|
|
@ -126,6 +126,7 @@ FILE *yyin;
|
|||
|
||||
static enum
|
||||
{
|
||||
FORMAT_UNKNOWN,
|
||||
FORMAT_RC,
|
||||
FORMAT_RES,
|
||||
FORMAT_POT
|
||||
|
@ -287,6 +288,15 @@ int main(int argc,char *argv[])
|
|||
input_name = argv[optind];
|
||||
}
|
||||
|
||||
/* Guess output format */
|
||||
if (output_format == FORMAT_UNKNOWN)
|
||||
{
|
||||
if (output_name && strendswith( output_name, ".res" )) output_format = FORMAT_RES;
|
||||
else if (output_name && strendswith( output_name, ".pot" )) output_format = FORMAT_POT;
|
||||
else output_format = FORMAT_RC;
|
||||
}
|
||||
if (output_format == FORMAT_RES) unicodeout = 1;
|
||||
|
||||
/* Generate appropriate outfile names */
|
||||
if(!output_name)
|
||||
{
|
||||
|
@ -340,6 +350,8 @@ int main(int argc,char *argv[])
|
|||
case FORMAT_POT:
|
||||
write_pot_file( output_name );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
output_name = NULL;
|
||||
header_name = NULL;
|
||||
|
|
Loading…
Reference in New Issue