widl: Determine the output type from the file name if not specified explicitly.

This commit is contained in:
Alexandre Julliard 2013-12-24 21:11:44 +01:00
parent 566d3418af
commit 9e307f268e
2 changed files with 20 additions and 3 deletions

View File

@ -669,14 +669,30 @@ int main(int argc,char *argv[])
wpp_add_include_path(DEFAULT_INCLUDE_DIR); wpp_add_include_path(DEFAULT_INCLUDE_DIR);
#endif #endif
/* if nothing specified, try to guess output type from the output file name */
if (output_name && do_everything && !do_header && !do_typelib && !do_proxies &&
!do_client && !do_server && !do_regscript && !do_idfile && !do_dlldata)
{
do_everything = 0;
if (strendswith( output_name, ".h" )) do_header = 1;
else if (strendswith( output_name, ".tlb" )) do_typelib = 1;
else if (strendswith( output_name, "_p.c" )) do_proxies = 1;
else if (strendswith( output_name, "_c.c" )) do_client = 1;
else if (strendswith( output_name, "_s.c" )) do_server = 1;
else if (strendswith( output_name, "_i.c" )) do_idfile = 1;
else if (strendswith( output_name, "_r.res" )) do_regscript = 1;
else if (strendswith( output_name, "_t.res" )) do_typelib = 1;
else if (strendswith( output_name, "dlldata.c" )) do_dlldata = 1;
else do_everything = 1;
}
if(do_everything) { if(do_everything) {
set_everything(TRUE); set_everything(TRUE);
} }
if (!output_name) output_name = dup_basename(input_name, ".idl"); if (!output_name) output_name = dup_basename(input_name, ".idl");
if (!do_everything && if (do_header + do_typelib + do_proxies + do_client +
do_header + do_typelib + do_proxies + do_client +
do_server + do_regscript + do_idfile + do_dlldata == 1) do_server + do_regscript + do_idfile + do_dlldata == 1)
{ {
if (do_header) header_name = output_name; if (do_header) header_name = output_name;

View File

@ -33,7 +33,8 @@ Print version number and exit.
.IP "\fB-o, --output=\fIname" .IP "\fB-o, --output=\fIname"
Set the name of the output file. When generating multiple output Set the name of the output file. When generating multiple output
files, this sets only the base name of the file; the respective output files, this sets only the base name of the file; the respective output
files are then named \fIname\fR.h, \fIname\fR_p.c, etc. files are then named \fIname\fR.h, \fIname\fR_p.c, etc. If a full
file name with extension is specified, only that file is generated.
.IP "\fB-b \fIcpu-manufacturer\fR[\fB-\fIkernel\fR]\fB-\fIos\fR" .IP "\fB-b \fIcpu-manufacturer\fR[\fB-\fIkernel\fR]\fB-\fIos\fR"
Set the target architecture when cross-compiling. The target Set the target architecture when cross-compiling. The target
specification is in the standard autoconf format as returned by specification is in the standard autoconf format as returned by