Alexandre Julliard : widl: Add a general -o option instead of having a different output name option for each file type .
Alexandre Julliard
julliard at winehq.org
Mon Nov 29 13:38:33 CST 2010
Module: wine
Branch: master
Commit: 233814c21ee2098c2d5c71bfc451fee430c2178f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=233814c21ee2098c2d5c71bfc451fee430c2178f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Sat Nov 27 12:33:05 2010 +0100
widl: Add a general -o option instead of having a different output name option for each file type.
---
Make.rules.in | 14 +++++++-------
tools/widl/widl.c | 28 +++++++++++++++++++++-------
tools/widl/widl.man.in | 37 ++++++++++++++-----------------------
3 files changed, 42 insertions(+), 37 deletions(-)
diff --git a/Make.rules.in b/Make.rules.in
index c5518c1..8aec95d 100644
--- a/Make.rules.in
+++ b/Make.rules.in
@@ -65,22 +65,22 @@ filter: dummy
$(LDPATH) $(WRC) $(RCFLAGS) -o $@ $<
.idl.h:
- $(WIDL) $(IDLFLAGS) -h -H $@ $<
+ $(WIDL) $(IDLFLAGS) -h -o $@ $<
.idl_c.c:
- $(WIDL) $(IDLFLAGS) -c -C $@ $<
+ $(WIDL) $(IDLFLAGS) -c -o $@ $<
.idl_i.c:
- $(WIDL) $(IDLFLAGS) -u -U $@ $<
+ $(WIDL) $(IDLFLAGS) -u -o $@ $<
.idl_p.c:
- $(WIDL) $(IDLFLAGS) -p -P $@ $<
+ $(WIDL) $(IDLFLAGS) -p -o $@ $<
.idl_s.c:
- $(WIDL) $(IDLFLAGS) -s -S $@ $<
+ $(WIDL) $(IDLFLAGS) -s -o $@ $<
.idl.tlb:
- $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -T $@ $<
+ $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $<
.c.ln:
$(LINT) -c $(ALLLINTFLAGS) $< || ( $(RM) $@ && exit 1 )
@@ -103,7 +103,7 @@ filter: dummy
# Rules for IDL files
dlldata.c: $(WIDL) Makefile.in
- $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS)
+ $(WIDL) $(IDLFLAGS) --dlldata-only -o $@ $(IDL_P_SRCS)
# Rule for linting
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index c4aa91f..05feae2 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -54,10 +54,8 @@ static const char usage[] =
" or: widl [options...] --dlldata-only name1 [name2...]\n"
" -b arch Set the target architecture\n"
" -c Generate client stub\n"
-" -C file Name of client stub file (default is infile_c.c)\n"
" -d n Set debug level to 'n'\n"
" -D id[=val] Define preprocessor identifier id=val\n"
-" --dlldata=file Name of the dlldata file (default is dlldata.c)\n"
" -E Preprocess only\n"
" -h Generate headers\n"
" -H file Name of header file (default is infile.h)\n"
@@ -66,17 +64,14 @@ static const char usage[] =
" -m32, -m64 Set the kind of typelib to build (Win32 or Win64)\n"
" -N Do not preprocess input\n"
" --oldnames Use old naming conventions\n"
+" -o, --output=NAME Set the output file name\n"
" -p Generate proxy\n"
-" -P file Name of proxy file (default is infile_p.c)\n"
" --prefix-all=p Prefix names of client stubs / server functions with 'p'\n"
" --prefix-client=p Prefix names of client stubs with 'p'\n"
" --prefix-server=p Prefix names of server functions with 'p'\n"
" -s Generate server stub\n"
-" -S file Name of server stub file (default is infile_s.c)\n"
" -t Generate typelib\n"
-" -T file Name of typelib file (default is infile.tlb)\n"
" -u Generate interface identifiers file\n"
-" -U file Name of interface identifiers file (default is infile_i.c)\n"
" -V Print version and exit\n"
" -W Enable pedantic warnings\n"
" --win32 Only generate 32-bit code\n"
@@ -157,12 +152,13 @@ enum {
};
static const char short_options[] =
- "b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
+ "b:cC:d:D:EhH:I:m:No:pP:sS:tT:uU:VW";
static const struct option long_options[] = {
{ "dlldata", 1, NULL, DLLDATA_OPTION },
{ "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
{ "local-stubs", 1, NULL, LOCAL_STUBS_OPTION },
{ "oldnames", 0, NULL, OLDNAMES_OPTION },
+ { "output", 0, NULL, 'o' },
{ "prefix-all", 1, NULL, PREFIX_ALL_OPTION },
{ "prefix-client", 1, NULL, PREFIX_CLIENT_OPTION },
{ "prefix-server", 1, NULL, PREFIX_SERVER_OPTION },
@@ -486,6 +482,7 @@ int main(int argc,char *argv[])
int optc;
int ret = 0;
int opti = 0;
+ char *output_name = NULL;
signal( SIGTERM, exit_on_signal );
signal( SIGINT, exit_on_signal );
@@ -577,6 +574,9 @@ int main(int argc,char *argv[])
case 'N':
no_preprocess = 1;
break;
+ case 'o':
+ output_name = xstrdup(optarg);
+ break;
case 'p':
do_everything = 0;
do_proxies = 1;
@@ -621,6 +621,20 @@ int main(int argc,char *argv[])
set_everything(TRUE);
}
+ if (!output_name) output_name = dup_basename(input_name, ".idl");
+
+ if (!do_everything &&
+ do_header + do_typelib + do_proxies + do_client + do_server + do_idfile + do_dlldata == 1)
+ {
+ if (do_header) header_name = output_name;
+ else if (do_typelib) typelib_name = output_name;
+ else if (do_proxies) proxy_name = output_name;
+ else if (do_client) client_name = output_name;
+ else if (do_server) server_name = output_name;
+ else if (do_idfile) idfile_name = output_name;
+ else if (do_dlldata) dlldata_name = output_name;
+ }
+
if (!dlldata_name && do_dlldata)
dlldata_name = xstrdup("dlldata.c");
diff --git a/tools/widl/widl.man.in b/tools/widl/widl.man.in
index 2757cdf..17aa8aa 100644
--- a/tools/widl/widl.man.in
+++ b/tools/widl/widl.man.in
@@ -31,6 +31,10 @@ will print a help message.
.B General options:
.IP "\fB-V\fR"
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.
.IP "\fB-b \fIcpu-manufacturer[-kernel]-os\fR"
Set the target architecture when cross-compiling. The target
specification is in the standard autoconf format as returned by
@@ -38,38 +42,25 @@ config.sub.
.PP
.B Header options:
.IP "\fB-h\fR"
-Generate header files.
-.IP "\fB-H \fIfile\fR"
-Name of header file to generate. The default header
-filename is \fIinfile\fR.h.
+Generate header files. The default output filename is \fIinfile\fB.h\fR.
.IP "\fB--oldnames\fR"
Use old naming conventions.
.PP
.B Type library options:
.IP \fB-t\fR
-Generate a type library.
-.IP "\fB-T \fIfile\fR"
-Define the name of the type library to be generated.
-The default filename is \fIinfile\fR.tlb.
+Generate a type library. The default output filename is \fIinfile\fB.tlb\fR.
.IP "\fB-m32, -m64\fR"
Generate a Win32, respectively Win64, type library.
.PP
.B UUID file options:
.IP "\fB-u\fR"
-Generate a UUID file.
-.IP "\fB-U \fIfile\fR"
-Define the name of the UUID file to be generated.
-The default filename is \fIinfile\fR_i.c.
+Generate a UUID file. The default output filename is \fIinfile\fB_i.c\fR.
.PP
.B Proxy/stub generation options:
.IP "\fB-c\fR"
-Generate client stub.
-.IP "\fB-C \fIfile\fR"
-Name of client stub file (default is \fIinfile\fR_c.c)
+Generate a client stub file. The default output filename is \fIinfile\fB_c.c\fR.
.IP "\fB-p\fR"
-Generate proxy.
-.IP "\fB-P \fIfile\fR"
-Name of proxy file (default is \fIinfile\fR_p.c)
+Generate a proxy. The default output filename is \fIinfile\fB_p.c\fR.
.IP "\fB--prefix-all=\fIprefix\fR"
Prefix to put on the name of both client and server stubs.
.IP "\fB--prefix-client=\fIprefix\fR"
@@ -77,17 +68,17 @@ Prefix to put on the name of client stubs.
.IP "\fB--prefix-server=\fIprefix\fR"
Prefix to put on the name of server stubs.
.IP "\fB-s\fR"
-Generate server stub.
-.IP "\fB-S \fIfile\fR"
-Name of server stub file (default is \fIinfile\fR_s.c)
+Generate a server stub file. The default output filename is
+\fIinfile\fB_s.c\fR.
.IP "\fB--win32, --win64\fR"
Only generate 32-bit, respectively 64-bit code (the default is to
generate both 32-bit and 64-bit versions into the same destination
file).
.PP
.B Dlldata file options:
-.IP "\fB--dlldata=\fIfile\fR"
-Name of the dlldata file (default is dlldata.c)
+.IP "\fB--dlldata-only\fI name1 [name2...]"
+Regenerate the dlldata file from scratch using the specified proxy
+names. The default output filename is \fBdlldata.c\fR.
.PP
.B Preprocessor options:
.IP "\fB-I \fIpath\fR"
More information about the wine-cvs
mailing list