Module: wine Branch: master Commit: 9e307f268ec3ae9328ca80a542941d9b5b492106 URL: http://source.winehq.org/git/wine.git/?a=commit;h=9e307f268ec3ae9328ca80a542...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Dec 24 21:11:44 2013 +0100
widl: Determine the output type from the file name if not specified explicitly.
---
tools/widl/widl.c | 20 ++++++++++++++++++-- tools/widl/widl.man.in | 3 ++- 2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/tools/widl/widl.c b/tools/widl/widl.c index b9e1412..902bc92 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -669,14 +669,30 @@ int main(int argc,char *argv[]) wpp_add_include_path(DEFAULT_INCLUDE_DIR); #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) { set_everything(TRUE); }
if (!output_name) output_name = dup_basename(input_name, ".idl");
- if (!do_everything && - do_header + do_typelib + do_proxies + do_client + + if (do_header + do_typelib + do_proxies + do_client + do_server + do_regscript + do_idfile + do_dlldata == 1) { if (do_header) header_name = output_name; diff --git a/tools/widl/widl.man.in b/tools/widl/widl.man.in index c5f0205..3ee5403 100644 --- a/tools/widl/widl.man.in +++ b/tools/widl/widl.man.in @@ -33,7 +33,8 @@ Print version number and exit. .IP "\fB-o, --output=\fIname" 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 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" Set the target architecture when cross-compiling. The target specification is in the standard autoconf format as returned by