Converted winebuild option parsing to use getopt_long. Added a number

of long aliases for the existing short options.
This commit is contained in:
Alexandre Julliard 2003-03-23 01:12:30 +00:00
parent bdbde0f814
commit 9e4fc4c9b6
15 changed files with 293 additions and 374 deletions

View File

@ -127,7 +127,7 @@ LINTS = $(C_SRCS:.c=.ln)
$(WINDRES) -i $< -o $@ $(WINDRES) -i $< -o $@
.spec.spec.c: .spec.spec.c:
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) --spec $< $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --spec $<
.spec.spec.def: .spec.spec.def:
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --def $< $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --def $<

View File

@ -26,7 +26,7 @@ all: $(MODULE)$(DLLEXT) $(SUBDIRS)
# Rules for .so files # Rules for .so files
$(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD) $(MAINSPEC).c: $(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(IMPORTLIBS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=-e %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --spec $(SRCDIR)/$(MAINSPEC) $(RC_SRCS:.rc=.res) $(SYMBOLFILE) $(DLLMAIN:%=--entry %) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
$(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in $(MODULE).so: $(MAINSPEC).o $(ALL_OBJS) Makefile.in
$(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc $(LDSHARED) $(LDDLLFLAGS) $(MAINSPEC).o $(ALL_OBJS) -o $@ -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(ALL_LIBS) -lc

View File

@ -34,7 +34,7 @@ all: $(TESTPROGRAM)
# Rule for main module spec file # Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD) $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(OBJS) $(IMPORTLIBS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -exe $(MODULE) -mcui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) --exe-mode cui $(RC_SRCS:.rc=.res) $(OBJS) -L$(DLLDIR) -L.. $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
# Rules for .so main module # Rules for .so main module

View File

@ -75,7 +75,7 @@ EXTRASUBDIRS = \
# Special rules for 16-bit resource and spec files # Special rules for 16-bit resource and spec files
gdi.exe.spec.c: gdi.exe.spec version16.res gdi.exe.spec.c: gdi.exe.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/gdi.exe.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --heap 65520 --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/gdi.exe.spec
version16.res: version16.rc version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc

View File

@ -52,7 +52,7 @@ kernel.res: $(MC_SRCS:.mc=.mc.rc)
# Special rules for 16-bit resource and spec files # Special rules for 16-bit resource and spec files
krnl386.exe.spec.c: krnl386.exe.spec version16.res krnl386.exe.spec.c: krnl386.exe.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -N kernel -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/krnl386.exe.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --dll-name kernel --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/krnl386.exe.spec
version16.res: version16.rc version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc

View File

@ -69,6 +69,6 @@ version16.res: version16.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/version16.rc
shell.spec.c: shell.spec version16.res shell.spec.c: shell.spec version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r version16.res --spec $(SRCDIR)/shell.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res version16.res --spec $(SRCDIR)/shell.spec
### Dependencies: ### Dependencies:

View File

@ -103,13 +103,13 @@ EXTRASUBDIRS = \
# Special rules for 16-bit resource and spec files # Special rules for 16-bit resource and spec files
user.exe.spec.c: user.exe.spec resources/version16.res user.exe.spec.c: user.exe.spec resources/version16.res
$(LDPATH) $(WINEBUILD) $(DEFS) -H 65520 -o $@ -M $(MODULE) -r resources/version16.res --spec $(SRCDIR)/user.exe.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --heap 65520 --main-module $(MODULE) --res resources/version16.res --spec $(SRCDIR)/user.exe.spec
display.spec.c: display.spec resources/display.res display.spec.c: display.spec resources/display.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/display.res --spec $(SRCDIR)/display.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res resources/display.res --spec $(SRCDIR)/display.spec
mouse.spec.c: mouse.spec resources/mouse.res mouse.spec.c: mouse.spec resources/mouse.res
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ -M $(MODULE) -r resources/mouse.res --spec $(SRCDIR)/mouse.spec $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --main-module $(MODULE) --res resources/mouse.res --spec $(SRCDIR)/mouse.spec
resources/display.res: resources/display.rc resources/display.res: resources/display.rc
$(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/display.rc $(LDPATH) $(WRC) $(WRCFLAGS) $(DIVINCL) -o $@ -w16 $(SRCDIR)/resources/display.rc

View File

@ -21,7 +21,7 @@ $(MODULE): $(ALL_OBJS)
$(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LIBS) $(LDFLAGS) $(CC) -o $@ $(ALL_OBJS) -L$(DLLDIR) $(LDIMPORTS:%=-l%) $(LIBWINE) $(LIBUNICODE) $(LIBPORT) $(LIBS) $(LDFLAGS)
wine.spec.c: $(WINEBUILD) wine.spec.c: $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe wine -mgui -e wine_initial_task -L$(DLLDIR) $(IMPORTS:%=-l%) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe wine --exe-mode gui --entry wine_initial_task -L$(DLLDIR) $(IMPORTS:%=-l%)
install:: $(MODULE) install:: $(MODULE)
$(MKINSTALLDIRS) $(bindir) $(MKINSTALLDIRS) $(bindir)

View File

@ -24,7 +24,7 @@ all: $(MODULE)$(DLLEXT) $(BASEMODULE)$(EXEEXT)
# Rule for main module spec file # Rule for main module spec file
$(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD) $(MODULE).spec.c: $(RC_SRCS:.rc=.res) $(ALL_OBJS) $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=-m%) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%) $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe $(MODULE) $(APPMODE:%=--exe-mode %) $(RC_SRCS:.rc=.res) $(ALL_OBJS) -L$(DLLDIR) $(DELAYIMPORTS:%=-d%) $(IMPORTS:%=-l%)
# Rules for .so main module # Rules for .so main module

View File

@ -18,13 +18,13 @@ C_SRCS = \
all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:.exe=$(EXEEXT)) all: $(PROGRAMS:%=%$(DLLEXT)) $(PROGRAMS:.exe=$(EXEEXT))
aviinfo.exe.spec.c: aviinfo.o $(WINEBUILD) aviinfo.exe.spec.c: aviinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviinfo.exe -mgui aviinfo.o -L$(DLLDIR) -lkernel32 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviinfo.exe --exe-mode gui aviinfo.o -L$(DLLDIR) -lkernel32
aviplay.exe.spec.c: aviplay.o $(WINEBUILD) aviplay.exe.spec.c: aviplay.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviplay.exe -mgui aviplay.o -L$(DLLDIR) -lddraw -lkernel32 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe aviplay.exe --exe-mode gui aviplay.o -L$(DLLDIR) -lddraw -lkernel32
icinfo.exe.spec.c: icinfo.o $(WINEBUILD) icinfo.exe.spec.c: icinfo.o $(WINEBUILD)
$(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe icinfo.exe -mgui icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32 $(LDPATH) $(WINEBUILD) $(DEFS) -o $@ --exe icinfo.exe --exe-mode gui icinfo.o -L$(DLLDIR) -lmsvfw32 -lkernel32
aviinfo.exe.so: aviinfo.o aviinfo.exe.spec.o aviinfo.exe.so: aviinfo.o aviinfo.exe.spec.o
$(LDSHARED) $(LDDLLFLAGS) -o $@ aviinfo.o aviinfo.exe.spec.o $(ALL_LIBS) -lc $(LDSHARED) $(LDDLLFLAGS) -o $@ aviinfo.o aviinfo.exe.spec.o $(ALL_LIBS) -lc

View File

@ -31,12 +31,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifdef HAVE_ASM_STRING
# define STRING ".string"
#else
# define STRING ".ascii"
#endif
typedef enum typedef enum
{ {
TYPE_VARIABLE, /* variable */ TYPE_VARIABLE, /* variable */
@ -185,9 +179,9 @@ extern int nb_errors;
extern int display_warnings; extern int display_warnings;
extern int kill_at; extern int kill_at;
extern char DLLName[80]; extern char *owner_name;
extern char DLLFileName[80]; extern char *dll_name;
extern char owner_name[80]; extern char *dll_file_name;
extern char *init_func; extern char *init_func;
extern char *input_file_name; extern char *input_file_name;
extern const char *output_file_name; extern const char *output_file_name;

View File

@ -30,6 +30,9 @@
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif
#include "build.h" #include "build.h"
@ -60,9 +63,9 @@ int debugging = 1;
int debugging = 0; int debugging = 0;
#endif #endif
char DLLName[80]; char *owner_name = NULL;
char DLLFileName[80]; char *dll_name = NULL;
char owner_name[80]; char *dll_file_name = NULL;
char *init_func = NULL; char *init_func = NULL;
char **debug_channels = NULL; char **debug_channels = NULL;
char **lib_path = NULL; char **lib_path = NULL;
@ -77,7 +80,7 @@ static int nb_res_files;
static char **res_files; static char **res_files;
/* execution mode */ /* execution mode */
static enum enum exec_mode_values
{ {
MODE_NONE, MODE_NONE,
MODE_SPEC, MODE_SPEC,
@ -87,20 +90,23 @@ static enum
MODE_DEBUG, MODE_DEBUG,
MODE_RELAY16, MODE_RELAY16,
MODE_RELAY32 MODE_RELAY32
} exec_mode = MODE_NONE; };
static enum exec_mode_values exec_mode = MODE_NONE;
/* set the dll file name from the input file name */ /* set the dll file name from the input file name */
static void set_dll_file_name( const char *name ) static void set_dll_file_name( const char *name )
{ {
char *p; char *p;
if (*DLLFileName) return; if (dll_file_name) return;
if ((p = strrchr( name, '\\' ))) name = p + 1; if ((p = strrchr( name, '\\' ))) name = p + 1;
if ((p = strrchr( name, '/' ))) name = p + 1; if ((p = strrchr( name, '/' ))) name = p + 1;
strcpy( DLLFileName, name ); dll_file_name = xmalloc( strlen(name) + 5 );
if ((p = strrchr( DLLFileName, '.' )) && !strcmp( p, ".spec" )) *p = 0; strcpy( dll_file_name, name );
if (!strchr( DLLFileName, '.' )) strcat( DLLFileName, ".dll" ); if ((p = strrchr( dll_file_name, '.' )) && !strcmp( p, ".spec" )) *p = 0;
if (!strchr( dll_file_name, '.' )) strcat( dll_file_name, ".dll" );
} }
/* cleanup on program exit */ /* cleanup on program exit */
@ -113,316 +119,232 @@ static void cleanup(void)
/******************************************************************* /*******************************************************************
* command-line option handling * command-line option handling
*/ */
static const char usage_str[] =
"Usage: winebuild [OPTIONS] [FILES]\n\n"
"Options:\n"
" -C --source-dir=DIR Look for source files in DIR\n"
" -d --delay-lib=LIB Import the specified library in delayed mode\n"
" -D SYM Ignored for C flags compatibility\n"
" -e --entry=FUNC Set the DLL entry point function (default: DllMain)\n"
" -f FLAGS Compiler flags (only -fPIC is supported)\n"
" -F --filename=DLLFILE Set the DLL filename (default: from input file name)\n"
" -h --help Display this help message\n"
" -H --heap=SIZE Set the heap size for a Win16 dll\n"
" -i --ignore=SYM[,SYM] Ignore specified symbols when resolving imports\n"
" -I DIR Ignored for C flags compatibility\n"
" -k --kill-at Kill stdcall decorations in generated .def files\n"
" -K FLAGS Compiler flags (only -KPIC is supported)\n"
" -l --library=LIB Import the specified library\n"
" -L --library-path=DIR Look for imports libraries in DIR\n"
" -m --exe-mode=MODE Set the executable mode (cui|gui|cuiw|guiw)\n"
" -M --main-module=MODULE Set the name of the main module for a Win16 dll\n"
" -N --dll-name=DLLNAME Set the DLL name (default: from input file name)\n"
" -o --output=NAME Set the output file name (default: stdout)\n"
" -r --res=RSRC.RES Load resources from RSRC.RES\n"
" --version Print the version and exit\n"
" -w --warnings Turn on warnings\n"
"\nMode options:\n"
" --spec=FILE.SPEC Build a .c file from a spec file\n"
" --def=FILE.SPEC Build a .def file from a spec file\n"
" --exe=NAME Build a .c file for the named executable\n"
" --debug [FILES] Build a .c file with the debug channels declarations\n"
" --glue [FILES] Build the 16-bit glue for the source files\n"
" --relay16 Build the 16-bit relay assembly routines\n"
" --relay32 Build the 32-bit relay assembly routines\n\n"
"The mode options are mutually exclusive; you must specify one and only one.\n\n";
struct option_descr enum long_options_values
{ {
const char *name; LONG_OPT_SPEC = 1,
int has_arg; LONG_OPT_DEF,
void (*func)(); LONG_OPT_EXE,
const char *usage; LONG_OPT_DEBUG,
LONG_OPT_GLUE,
LONG_OPT_RELAY16,
LONG_OPT_RELAY32,
LONG_OPT_VERSION
}; };
static void do_output( const char *arg ); static const char short_options[] = "C:D:F:H:I:K:L:M:N:d:e:f:hi:kl:m:o:r:w";
static void do_usage(void);
static void do_warnings(void);
static void do_f_flags( const char *arg );
static void do_define( const char *arg );
static void do_include( const char *arg );
static void do_k_flags( const char *arg );
static void do_ignore( const char *arg );
static void do_kill_at(void);
static void do_exe_mode( const char *arg );
static void do_module( const char *arg );
static void do_heap( const char *arg );
static void do_name( const char *arg );
static void do_file( const char *arg );
static void do_entry( const char *arg );
static void do_spec( const char *arg );
static void do_def( const char *arg );
static void do_exe( const char *arg );
static void do_glue(void);
static void do_relay16(void);
static void do_relay32(void);
static void do_debug(void);
static void do_chdir( const char *arg );
static void do_lib( const char *arg );
static void do_import( const char *arg );
static void do_dimport( const char *arg );
static void do_rsrc( const char *arg );
static const struct option_descr option_table[] = static const struct option long_options[] =
{ {
{ "-h", 0, do_usage, "-h Display this help message" }, { "spec", 1, 0, LONG_OPT_SPEC },
{ "-w", 0, do_warnings,"-w Turn on warnings" }, { "def", 1, 0, LONG_OPT_DEF },
{ "-C", 1, do_chdir, "-C dir Change directory to <dir> before opening source files" }, { "exe", 1, 0, LONG_OPT_EXE },
{ "-f", 1, do_f_flags, "-f flags Compiler flags (only -fPIC is supported)" }, { "debug", 0, 0, LONG_OPT_DEBUG },
{ "-D", 1, do_define, "-D sym Ignored for C flags compatibility" }, { "glue", 0, 0, LONG_OPT_GLUE },
{ "-I", 1, do_include, "-I dir Ignored for C flags compatibility" }, { "relay16", 0, 0, LONG_OPT_RELAY16 },
{ "-K", 1, do_k_flags, "-K flags Compiler flags (only -KPIC is supported)" }, { "relay32", 0, 0, LONG_OPT_RELAY32 },
{ "-i", 1, do_ignore, "-i sym[,sym] Ignore specified symbols when resolving imports" }, { "version", 0, 0, LONG_OPT_VERSION },
{ "-k", 0, do_kill_at, "-k Kill stdcall decorations in generated .def files" }, /* aliases for short options */
{ "-m", 1, do_exe_mode,"-m mode Set the executable mode (cui|gui|cuiw|guiw)" }, { "source-dir", 1, 0, 'C' },
{ "-M", 1, do_module, "-M module Set the name of the main (Win32) module for a Win16 dll" }, { "delay-lib", 1, 0, 'd' },
{ "-L", 1, do_lib, "-L directory Look for imports libraries in 'directory'" }, { "entry", 1, 0, 'e' },
{ "-l", 1, do_import, "-l lib.dll Import the specified library" }, { "filename", 1, 0, 'F' },
{ "-d", 1, do_dimport, "-d lib.dll Delay-import the specified library" }, { "help", 0, 0, 'h' },
{ "-H", 1, do_heap, "-H size Set the heap size for a Win16 dll" }, { "heap", 1, 0, 'H' },
{ "-N", 1, do_name, "-N dllname Set the DLL name (default: set from input file name)" }, { "ignore", 1, 0, 'i' },
{ "-F", 1, do_file, "-F dllfile Set the DLL filename (default: set from input file name)" }, { "kill-at", 0, 0, 'k' },
{ "-e", 1, do_entry, "-e function Set the DLL entry point function (default: DllMain)" }, { "library", 1, 0, 'l' },
{ "-r", 1, do_rsrc, "-r rsrc.res Load resources from rsrc.res" }, { "library-path", 1, 0, 'L' },
{ "-res", 1, do_rsrc, NULL }, /* for backwards compatibility, will disappear */ { "exe-mode", 1, 0, 'm' },
{ "-o", 1, do_output, "-o name Set the output file name (default: stdout)\n" }, { "main-module", 1, 0, 'M' },
{ "--spec", 1, do_spec, "--spec file.spec Build a .c file from a spec file" }, { "dll-name", 1, 0, 'N' },
{ "--def", 1, do_def, "--def file.spec Build a .def file from a spec file" }, { "output", 1, 0, 'o' },
{ "--exe", 1, do_exe, "--exe name Build a .c file for the named executable" }, { "res", 1, 0, 'r' },
{ "--debug", 0, do_debug, "--debug [files] Build a .c file containing debug channels declarations" }, { "warnings", 0, 0, 'w' },
{ "--glue", 0, do_glue, "--glue [files] Build the 16-bit glue for the source files" }, { NULL, 0, 0, 0 }
{ "--relay16", 0, do_relay16, "--relay16 Build the 16-bit relay assembly routines" },
{ "--relay32", 0, do_relay32, "--relay32 Build the 32-bit relay assembly routines" },
{ NULL, 0, NULL, NULL }
}; };
static void do_output( const char *arg ) static void usage( int exit_code )
{ {
if ( ( unlink ( arg ) ) == -1 && ( errno != ENOENT ) ) fprintf( stderr, "%s", usage_str );
{ exit( exit_code );
fprintf ( stderr, "Unable to create output file '%s'\n", arg );
exit (1);
}
if (!(output_file = fopen( arg, "w" )))
{
fprintf( stderr, "Unable to create output file '%s'\n", arg );
exit(1);
}
output_file_name = arg;
atexit( cleanup ); /* make sure we remove the output file on exit */
} }
static void do_usage(void) static void set_exec_mode( enum exec_mode_values mode )
{ {
const struct option_descr *opt; if (exec_mode != MODE_NONE) usage(1);
fprintf( stderr, "Usage: winebuild [options]\n\n" ); exec_mode = mode;
fprintf( stderr, "Options:\n" );
for (opt = option_table; opt->name; opt++)
if (opt->usage) fprintf( stderr, " %s\n", opt->usage );
fprintf( stderr, "\nExactly one of --spec, --def, --exe, --debug, --glue, --relay16 or --relay32 must be specified.\n\n" );
exit(1);
}
static void do_warnings(void)
{
display_warnings = 1;
}
static void do_f_flags( const char *arg )
{
if (!strcmp( arg, "PIC" )) UsePIC = 1;
/* ignore all other flags */
}
static void do_define( const char *arg )
{
/* nothing */
}
static void do_include( const char *arg )
{
/* nothing */
}
static void do_k_flags( const char *arg )
{
/* Ignored, because cc generates correct code. */
/* if (!strcmp( arg, "PIC" )) UsePIC = 1; */
/* ignore all other flags */
}
static void do_ignore( const char *arg )
{
char *str = xstrdup( arg );
char *token = strtok( str, "," );
while (token)
{
add_ignore_symbol( token );
token = strtok( NULL, "," );
}
free( str );
}
static void do_kill_at(void)
{
kill_at = 1;
}
static void do_heap( const char *arg )
{
if (!isdigit(arg[0]))
fatal_error( "Expected number argument with -H option instead of '%s'\n", arg );
DLLHeapSize = atoi(arg);
if (DLLHeapSize > 65535) fatal_error( "Invalid heap size %d, maximum is 65535\n", DLLHeapSize );
}
static void do_name( const char *arg )
{
strncpy( DLLName, arg, sizeof(DLLName) );
DLLName[sizeof(DLLName) - 1] = 0;
}
static void do_file( const char *arg )
{
strncpy( DLLFileName, arg, sizeof(DLLFileName) );
DLLFileName[sizeof(DLLFileName) - 1] = 0;
}
static void do_entry( const char *arg )
{
init_func = xstrdup( arg );
}
static void do_spec( const char *arg )
{
if (exec_mode != MODE_NONE || !arg[0]) do_usage();
exec_mode = MODE_SPEC;
input_file = open_input_file( NULL, arg );
set_dll_file_name( arg );
}
static void do_def( const char *arg )
{
if (exec_mode != MODE_NONE || !arg[0]) do_usage();
exec_mode = MODE_DEF;
input_file = open_input_file( NULL, arg );
set_dll_file_name( arg );
}
static void do_exe( const char *arg )
{
const char *p;
if (exec_mode != MODE_NONE || !arg[0]) do_usage();
exec_mode = MODE_EXE;
if ((p = strrchr( arg, '/' ))) p++;
else p = arg;
strcpy( DLLFileName, p );
if (!strchr( DLLFileName, '.' )) strcat( DLLFileName, ".exe" );
if (SpecMode == SPEC_MODE_DLL) SpecMode = SPEC_MODE_GUIEXE;
}
static void do_exe_mode( const char *arg )
{
if (!strcmp( arg, "gui" )) SpecMode = SPEC_MODE_GUIEXE;
else if (!strcmp( arg, "cui" )) SpecMode = SPEC_MODE_CUIEXE;
else if (!strcmp( arg, "guiw" )) SpecMode = SPEC_MODE_GUIEXE_UNICODE;
else if (!strcmp( arg, "cuiw" )) SpecMode = SPEC_MODE_CUIEXE_UNICODE;
else do_usage();
}
static void do_module( const char *arg )
{
strcpy( owner_name, arg );
SpecType = SPEC_WIN16;
}
static void do_glue(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_GLUE;
}
static void do_debug(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_DEBUG;
}
static void do_chdir( const char *arg )
{
current_src_dir = arg;
}
static void do_relay16(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_RELAY16;
}
static void do_relay32(void)
{
if (exec_mode != MODE_NONE) do_usage();
exec_mode = MODE_RELAY32;
}
static void do_lib( const char *arg )
{
lib_path = xrealloc( lib_path, (nb_lib_paths+1) * sizeof(*lib_path) );
lib_path[nb_lib_paths++] = xstrdup( arg );
}
static void do_import( const char *arg )
{
add_import_dll( arg, 0 );
}
static void do_dimport( const char *arg )
{
add_import_dll( arg, 1 );
}
static void do_rsrc( const char *arg )
{
res_files = xrealloc( res_files, (nb_res_files+1) * sizeof(*res_files) );
res_files[nb_res_files++] = xstrdup( arg );
} }
/* parse options from the argv array and remove all the recognized ones */ /* parse options from the argv array and remove all the recognized ones */
static void parse_options( char *argv[] ) static char **parse_options( int argc, char **argv )
{ {
const struct option_descr *opt; const char *p;
char **ptr, **last; int optc;
const char* arg=NULL;
for (ptr = last = argv; *ptr; ptr++) while ((optc = getopt_long( argc, argv, short_options, long_options, NULL )) != -1)
{ {
/* first check the exact option name */ switch(optc)
for (opt = option_table; opt->name; opt++)
{ {
if (!strcmp( *ptr, opt->name ) || case 'C':
/* for long option check without the first dash too */ current_src_dir = optarg;
(opt->name[1] == '-' && !strcmp( *ptr, opt->name+1 ))) break;
case 'D':
/* ignored */
break;
case 'F':
dll_file_name = xstrdup( optarg );
break;
case 'H':
if (!isdigit(optarg[0]))
fatal_error( "Expected number argument with -H option instead of '%s'\n", optarg );
DLLHeapSize = atoi(optarg);
if (DLLHeapSize > 65535)
fatal_error( "Invalid heap size %d, maximum is 65535\n", DLLHeapSize );
break;
case 'I':
/* ignored */
break;
case 'K':
/* ignored, because cc generates correct code. */
break;
case 'L':
lib_path = xrealloc( lib_path, (nb_lib_paths+1) * sizeof(*lib_path) );
lib_path[nb_lib_paths++] = xstrdup( optarg );
break;
case 'M':
owner_name = xstrdup( optarg );
SpecType = SPEC_WIN16;
break;
case 'N':
dll_name = xstrdup( optarg );
break;
case 'd':
add_import_dll( optarg, 1 );
break;
case 'e':
init_func = xstrdup( optarg );
break;
case 'f':
if (!strcmp( optarg, "PIC") || !strcmp( optarg, "pic")) UsePIC = 1;
/* ignore all other flags */
break;
case 'h':
usage(0);
break;
case 'i':
{ {
if (opt->has_arg) arg = *(++ptr); char *str = xstrdup( optarg );
else arg = NULL; char *token = strtok( str, "," );
break; while (token)
}
}
/* now check for option name concatenated with argument */
if (!opt->name)
{
for (opt = option_table; opt->name; opt++)
{
if (opt->has_arg && !strncmp( *ptr, opt->name, strlen(opt->name) ))
{ {
arg = *ptr + strlen(opt->name); add_ignore_symbol( token );
break; token = strtok( NULL, "," );
} }
free( str );
} }
} break;
case 'k':
if (opt->name) kill_at = 1;
{ break;
if (opt->has_arg && arg != NULL) opt->func( arg ); case 'l':
else opt->func( "" ); add_import_dll( optarg, 0 );
} break;
else /* keep this argument */ case 'm':
{ if (!strcmp( optarg, "gui" )) SpecMode = SPEC_MODE_GUIEXE;
if (last != ptr) *last = *ptr; else if (!strcmp( optarg, "cui" )) SpecMode = SPEC_MODE_CUIEXE;
last++; else if (!strcmp( optarg, "guiw" )) SpecMode = SPEC_MODE_GUIEXE_UNICODE;
else if (!strcmp( optarg, "cuiw" )) SpecMode = SPEC_MODE_CUIEXE_UNICODE;
else usage(1);
break;
case 'o':
if (unlink( optarg ) == -1 && errno != ENOENT)
fatal_error( "Unable to create output file '%s'\n", optarg );
if (!(output_file = fopen( optarg, "w" )))
fatal_error( "Unable to create output file '%s'\n", optarg );
output_file_name = xstrdup(optarg);
atexit( cleanup ); /* make sure we remove the output file on exit */
break;
case 'r':
res_files = xrealloc( res_files, (nb_res_files+1) * sizeof(*res_files) );
res_files[nb_res_files++] = xstrdup( optarg );
break;
case 'w':
display_warnings = 1;
break;
case LONG_OPT_SPEC:
set_exec_mode( MODE_SPEC );
input_file = open_input_file( NULL, optarg );
set_dll_file_name( optarg );
break;
case LONG_OPT_DEF:
set_exec_mode( MODE_DEF );
input_file = open_input_file( NULL, optarg );
set_dll_file_name( optarg );
break;
case LONG_OPT_EXE:
set_exec_mode( MODE_EXE );
if ((p = strrchr( optarg, '/' ))) p++;
else p = optarg;
dll_file_name = xmalloc( strlen(p) + 5 );
strcpy( dll_file_name, p );
if (!strchr( dll_file_name, '.' )) strcat( dll_file_name, ".exe" );
if (SpecMode == SPEC_MODE_DLL) SpecMode = SPEC_MODE_GUIEXE;
break;
case LONG_OPT_DEBUG:
set_exec_mode( MODE_DEBUG );
break;
case LONG_OPT_GLUE:
set_exec_mode( MODE_GLUE );
break;
case LONG_OPT_RELAY16:
set_exec_mode( MODE_RELAY16 );
break;
case LONG_OPT_RELAY32:
set_exec_mode( MODE_RELAY32 );
break;
case LONG_OPT_VERSION:
printf( "winebuild version " PACKAGE_VERSION "\n" );
exit(0);
case '?':
usage(1);
break;
} }
} }
*last = NULL; return &argv[optind];
} }
@ -462,22 +384,22 @@ static void load_resources( char *argv[] )
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
output_file = stdout; output_file = stdout;
parse_options( argv + 1 ); argv = parse_options( argc, argv );
switch(exec_mode) switch(exec_mode)
{ {
case MODE_SPEC: case MODE_SPEC:
load_resources( argv + 1 ); load_resources( argv );
if (!ParseTopLevel( input_file )) break; if (!ParseTopLevel( input_file )) break;
switch (SpecType) switch (SpecType)
{ {
case SPEC_WIN16: case SPEC_WIN16:
if (argv[1]) if (argv[0])
fatal_error( "file argument '%s' not allowed in this mode\n", argv[1] ); fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildSpec16File( output_file ); BuildSpec16File( output_file );
break; break;
case SPEC_WIN32: case SPEC_WIN32:
read_undef_symbols( argv + 1 ); read_undef_symbols( argv );
BuildSpec32File( output_file ); BuildSpec32File( output_file );
break; break;
default: assert(0); default: assert(0);
@ -485,32 +407,32 @@ int main(int argc, char **argv)
break; break;
case MODE_EXE: case MODE_EXE:
if (SpecType == SPEC_WIN16) fatal_error( "Cannot build 16-bit exe files\n" ); if (SpecType == SPEC_WIN16) fatal_error( "Cannot build 16-bit exe files\n" );
load_resources( argv + 1 ); load_resources( argv );
read_undef_symbols( argv + 1 ); read_undef_symbols( argv );
BuildSpec32File( output_file ); BuildSpec32File( output_file );
break; break;
case MODE_DEF: case MODE_DEF:
if (argv[1]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[1] ); if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
if (SpecType == SPEC_WIN16) fatal_error( "Cannot yet build .def file for 16-bit dlls\n" ); if (SpecType == SPEC_WIN16) fatal_error( "Cannot yet build .def file for 16-bit dlls\n" );
if (!ParseTopLevel( input_file )) break; if (!ParseTopLevel( input_file )) break;
BuildDef32File( output_file ); BuildDef32File( output_file );
break; break;
case MODE_DEBUG: case MODE_DEBUG:
BuildDebugFile( output_file, current_src_dir, argv + 1 ); BuildDebugFile( output_file, current_src_dir, argv );
break; break;
case MODE_GLUE: case MODE_GLUE:
BuildGlue( output_file, current_src_dir, argv + 1 ); BuildGlue( output_file, current_src_dir, argv );
break; break;
case MODE_RELAY16: case MODE_RELAY16:
if (argv[1]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[1] ); if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildRelays16( output_file ); BuildRelays16( output_file );
break; break;
case MODE_RELAY32: case MODE_RELAY32:
if (argv[1]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[1] ); if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildRelays32( output_file ); BuildRelays32( output_file );
break; break;
default: default:
do_usage(); usage(1);
break; break;
} }
if (nb_errors) exit(1); if (nb_errors) exit(1);

View File

@ -154,8 +154,8 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
pModule->fileinfo = (int)pFileInfo - (int)pModule; pModule->fileinfo = (int)pFileInfo - (int)pModule;
memset( pFileInfo, 0, sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) ); memset( pFileInfo, 0, sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) );
pFileInfo->cBytes = sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) pFileInfo->cBytes = sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName)
+ strlen(DLLFileName); + strlen(dll_file_name);
strcpy( pFileInfo->szPathName, DLLFileName ); strcpy( pFileInfo->szPathName, dll_file_name );
pstr = (char *)pFileInfo + pFileInfo->cBytes + 1; pstr = (char *)pFileInfo + pFileInfo->cBytes + 1;
/* Segment table */ /* Segment table */
@ -197,8 +197,8 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
pstr = (char *)(((long)pstr + 3) & ~3); pstr = (char *)(((long)pstr + 3) & ~3);
pModule->name_table = (int)pstr - (int)pModule; pModule->name_table = (int)pstr - (int)pModule;
/* First entry is module name */ /* First entry is module name */
*pstr = strlen( DLLName ); *pstr = strlen( dll_name );
strcpy( pstr + 1, DLLName ); strcpy( pstr + 1, dll_name );
strupper( pstr + 1 ); strupper( pstr + 1 );
pstr += *pstr + 1; pstr += *pstr + 1;
*pstr++ = 0; *pstr++ = 0;
@ -592,7 +592,7 @@ static void output_stub_funcs( FILE *outfile )
fprintf( outfile, " rec.flags = %d;\n", EH_NONCONTINUABLE ); fprintf( outfile, " rec.flags = %d;\n", EH_NONCONTINUABLE );
fprintf( outfile, " rec.rec = 0;\n" ); fprintf( outfile, " rec.rec = 0;\n" );
fprintf( outfile, " rec.params = 2;\n" ); fprintf( outfile, " rec.params = 2;\n" );
fprintf( outfile, " rec.info[0] = \"%s\";\n", DLLFileName ); fprintf( outfile, " rec.info[0] = \"%s\";\n", dll_file_name );
fprintf( outfile, " rec.info[1] = func;\n" ); fprintf( outfile, " rec.info[1] = func;\n" );
fprintf( outfile, "#ifdef __GNUC__\n" ); fprintf( outfile, "#ifdef __GNUC__\n" );
fprintf( outfile, " rec.addr = __builtin_return_address(1);\n" ); fprintf( outfile, " rec.addr = __builtin_return_address(1);\n" );
@ -644,11 +644,11 @@ void BuildSpec16File( FILE *outfile )
memset( data, 0, 16 ); memset( data, 0, 16 );
data_offset = 16; data_offset = 16;
if (!DLLName[0]) /* set default name from file name */ if (!dll_name) /* set default name from file name */
{ {
char *p; char *p;
strcpy( DLLName, DLLFileName ); dll_name = xstrdup( dll_file_name );
if ((p = strrchr( DLLName, '.' ))) *p = 0; if ((p = strrchr( dll_name, '.' ))) *p = 0;
} }
output_stub_funcs( outfile ); output_stub_funcs( outfile );
@ -691,7 +691,7 @@ void BuildSpec16File( FILE *outfile )
char profile[101]; char profile[101];
strcpy( profile, get_function_name( typelist[i] )); strcpy( profile, get_function_name( typelist[i] ));
BuildCallFrom16Func( outfile, profile, DLLFileName ); BuildCallFrom16Func( outfile, profile, dll_file_name );
} }
#endif #endif
@ -788,7 +788,7 @@ void BuildSpec16File( FILE *outfile )
#ifdef __i386__ #ifdef __i386__
fprintf( outfile, " { 0x68, __wine_%s_CallFrom16_%s, 0x9a, __wine_call_from_16_%s,\n", fprintf( outfile, " { 0x68, __wine_%s_CallFrom16_%s, 0x9a, __wine_call_from_16_%s,\n",
make_c_identifier(DLLFileName), profile, make_c_identifier(dll_file_name), profile,
(typelist[i]->flags & (FLAG_REGISTER|FLAG_INTERRUPT)) ? "regs": (typelist[i]->flags & (FLAG_REGISTER|FLAG_INTERRUPT)) ? "regs":
typelist[i]->type == TYPE_PASCAL_16? "word" : "long" ); typelist[i]->type == TYPE_PASCAL_16? "word" : "long" );
if (argsize) if (argsize)
@ -831,7 +831,7 @@ void BuildSpec16File( FILE *outfile )
type = bsearch( &odp, typelist, nTypes, sizeof(ORDDEF *), Spec16TypeCompare ); type = bsearch( &odp, typelist, nTypes, sizeof(ORDDEF *), Spec16TypeCompare );
assert( type ); assert( type );
fprintf( outfile, " /* %s.%d */ ", DLLName, i ); fprintf( outfile, " /* %s.%d */ ", dll_name, i );
#ifdef __i386__ #ifdef __i386__
fprintf( outfile, "{ 0x5566, 0x68, %s, 0xe866, %d /* %s */ },\n", fprintf( outfile, "{ 0x5566, 0x68, %s, 0xe866, %d /* %s */ },\n",
#else #else
@ -886,8 +886,8 @@ void BuildSpec16File( FILE *outfile )
/* Output the DLL constructor */ /* Output the DLL constructor */
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(DLLFileName) ); sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(dll_file_name) );
sprintf( destructor, "__wine_spec_%s_fini", make_c_identifier(DLLFileName) ); sprintf( destructor, "__wine_spec_%s_fini", make_c_identifier(dll_file_name) );
output_dll_init( outfile, constructor, destructor ); output_dll_init( outfile, constructor, destructor );
fprintf( outfile, fprintf( outfile,

View File

@ -53,13 +53,13 @@ static const char *make_internal_name( const ORDDEF *odp, const char *prefix )
if (odp->name || odp->export_name) if (odp->name || odp->export_name)
{ {
char *p; char *p;
sprintf( buffer, "__wine_%s_%s_%s", prefix, DLLFileName, sprintf( buffer, "__wine_%s_%s_%s", prefix, dll_file_name,
odp->name ? odp->name : odp->export_name ); odp->name ? odp->name : odp->export_name );
/* make sure name is a legal C identifier */ /* make sure name is a legal C identifier */
for (p = buffer; *p; p++) if (!isalnum(*p) && *p != '_') break; for (p = buffer; *p; p++) if (!isalnum(*p) && *p != '_') break;
if (!*p) return buffer; if (!*p) return buffer;
} }
sprintf( buffer, "__wine_%s_%s_%d", prefix, make_c_identifier(DLLFileName), odp->ordinal ); sprintf( buffer, "__wine_%s_%s_%d", prefix, make_c_identifier(dll_file_name), odp->ordinal );
return buffer; return buffer;
} }
@ -495,7 +495,7 @@ void BuildSpec32File( FILE *outfile )
fprintf( outfile, "}\n" ); fprintf( outfile, "}\n" );
fprintf( outfile, "#endif\n" ); fprintf( outfile, "#endif\n" );
fprintf( outfile, "static const char dllname[] = \"%s\";\n\n", DLLFileName ); fprintf( outfile, "static const char dllname[] = \"%s\";\n\n", dll_file_name );
fprintf( outfile, "extern int __wine_spec_exports[];\n\n" ); fprintf( outfile, "extern int __wine_spec_exports[];\n\n" );
#ifdef __i386__ #ifdef __i386__
@ -773,7 +773,7 @@ void BuildSpec32File( FILE *outfile )
/* Output the DLL constructor */ /* Output the DLL constructor */
sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(DLLFileName) ); sprintf( constructor, "__wine_spec_%s_init", make_c_identifier(dll_file_name) );
output_dll_init( outfile, constructor, NULL ); output_dll_init( outfile, constructor, NULL );
fprintf( outfile, fprintf( outfile,
@ -783,7 +783,7 @@ void BuildSpec32File( FILE *outfile )
" extern void *__wine_dbg_register( char * const *, int );\n" " extern void *__wine_dbg_register( char * const *, int );\n"
" __wine_dll_register( &nt_header, \"%s\" );\n" " __wine_dll_register( &nt_header, \"%s\" );\n"
"}\n", "}\n",
constructor, DLLFileName ); constructor, dll_file_name );
} }
@ -802,7 +802,7 @@ void BuildDef32File(FILE *outfile)
fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n", fprintf(outfile, "; File generated automatically from %s; do not edit!\n\n",
input_file_name ); input_file_name );
fprintf(outfile, "LIBRARY %s\n\n", DLLFileName); fprintf(outfile, "LIBRARY %s\n\n", dll_file_name);
fprintf(outfile, "EXPORTS\n"); fprintf(outfile, "EXPORTS\n");

View File

@ -1,5 +1,5 @@
.\" -*- nroff -*- .\" -*- nroff -*-
.TH WINEBUILD 1 "December 2002" "@PACKAGE_STRING@" "Wine dll builder" .TH WINEBUILD 1 "March 2003" "@PACKAGE_STRING@" "Wine dll builder"
.SH NAME .SH NAME
winebuild \- Wine dll builder winebuild \- Wine dll builder
.SH SYNOPSIS .SH SYNOPSIS
@ -19,7 +19,7 @@ option can be specified, as described in the \fBOPTIONS\fR section.
You have to specify exactly one of the following options, depending on You have to specify exactly one of the following options, depending on
what you want winebuild to generate. what you want winebuild to generate.
.TP .TP
.BI \--spec\ file.spec .BI \--spec=\ file.spec
Build a C file from a spec file (see \fBSPEC FILE SYNTAX\fR for Build a C file from a spec file (see \fBSPEC FILE SYNTAX\fR for
details). The resulting C file must be compiled and linked to the details). The resulting C file must be compiled and linked to the
other object files to build a working Wine dll. other object files to build a working Wine dll.
@ -32,7 +32,7 @@ final dll, to allow
to get the list of all undefined symbols that need to be imported from to get the list of all undefined symbols that need to be imported from
other dlls. other dlls.
.TP .TP
.BI \--exe\ name .BI \--exe=\ name
Build a C file for the named executable. This is basically the same as Build a C file for the named executable. This is basically the same as
the --spec mode except that it doesn't require a .spec file as input, the --spec mode except that it doesn't require a .spec file as input,
since an executable doesn't export functions. The resulting C file since an executable doesn't export functions. The resulting C file
@ -41,7 +41,7 @@ working Wine executable, and all the other object files must be listed
as as
.I input files. .I input files.
.TP .TP
.BI \--def\ file.spec .BI \--def=\ file.spec
Build a .def file from a spec file. This is used when building dlls Build a .def file from a spec file. This is used when building dlls
with a PE (Win32) compiler. with a PE (Win32) compiler.
.TP .TP
@ -69,7 +69,7 @@ Generate the assembly code for the 32-bit relay routines. This is for
Wine internal usage only, you should never need to use this option. Wine internal usage only, you should never need to use this option.
.SH OPTIONS .SH OPTIONS
.TP .TP
.BI \-C\ directory .BI \-C,\ --source-dir= directory
Change to the specified directory before reading source files. Only Change to the specified directory before reading source files. Only
meaningful in meaningful in
.BR \--debug\ and\ --glue\ modes. .BR \--debug\ and\ --glue\ modes.
@ -77,7 +77,7 @@ meaningful in
.BI \-D\ symbol .BI \-D\ symbol
Ignored for compatibility with the C compiler. Ignored for compatibility with the C compiler.
.TP .TP
.BI \-e\ function .BI \-e,\ --entry= function
Specify the module entry point function; if not specified, the default Specify the module entry point function; if not specified, the default
is is
.B DllMain .B DllMain
@ -91,21 +91,18 @@ modules.
.BI \-f\ flags .BI \-f\ flags
Ignored for compatibility with the C compiler. Ignored for compatibility with the C compiler.
.TP .TP
.BI \-F\ filename .BI \-F,\ --filename= filename
Set the file name of the module. The default is to use the base name Set the file name of the module. The default is to use the base name
of the spec file (without any extension). of the spec file (without any extension).
.TP .TP
.B \-h .B \-h, --help
Display a usage message and exit. Display a usage message and exit.
.TP .TP
.BI \-H\ size .BI \-H,\ --heap= size
Specify the size of the module local heap in bytes (only valid for Specify the size of the module local heap in bytes (only valid for
Win16 modules); default is no local heap. Win16 modules); default is no local heap.
.TP .TP
.BI \-I\ directory .BI \-i,\ --ignore= [-]symbol[,[-]symbol]
Ignored for compatibility with the C compiler.
.TP
.BI \-i\ [-]symbol[,[-]symbol]
Specify a list of symbols that should be ignored when resolving Specify a list of symbols that should be ignored when resolving
undefined symbols against the imported libraries. This forces these undefined symbols against the imported libraries. This forces these
symbols to be resolved from the Unix C library (or from another Unix symbols to be resolved from the Unix C library (or from another Unix
@ -113,33 +110,36 @@ library linked with the application). If a symbol is prefixed by '-'
it is removed from the list instead of being added; a stand-alone '-' it is removed from the list instead of being added; a stand-alone '-'
clears the whole list. clears the whole list.
.TP .TP
.BI \-K\ flags .BI \-I\ directory
Ignored for compatibility with the C compiler. Ignored for compatibility with the C compiler.
.TP .TP
.BI \-k .B \-k, --kill-at
Remove the stdcall decorations from the symbol names in the Remove the stdcall decorations from the symbol names in the
generated .def file. Only meaningful in \fB--def\fR mode. generated .def file. Only meaningful in \fB--def\fR mode.
.TP .TP
.BI \-L\ directory .BI \-K\ flags
Ignored for compatibility with the C compiler.
.TP
.BI \-L,\ --library-path= directory
Append the specified directory to the list of directories that are Append the specified directory to the list of directories that are
searched for import libraries. searched for import libraries.
.TP .TP
.BI \-l\ lib.dll .BI \-l,\ --library= name
Import the specified library, looking for a corresponding Import the specified library, looking for a corresponding
\fIlib.dll.so\fR file in the directories specified with the \fB-L\fR \fIlibname.def\fR file in the directories specified with the \fB-L\fR
option. option.
.TP .TP
.BI \-dl\ lib.dll .BI \-d,\ --delay-lib= name
Same as the \fB-l\fR option, but import the specified library in Same as the \fB-l\fR option, but import the specified library in
delayed mode (i.e. the library won't be loaded until a function delayed mode (i.e. the library won't be loaded until a function
imported from it is actually called). imported from it is actually called).
.TP .TP
.BI \-M\ module .BI \-M,\ --main-module= module
Specify that we are building a 16-bit dll, that will ultimately be Specify that we are building a 16-bit dll, that will ultimately be
linked together with the 32-bit dll specified in \fImodule\fR. Only linked together with the 32-bit dll specified in \fImodule\fR. Only
meaningful in \fB--spec\fR mode. meaningful in \fB--spec\fR mode.
.TP .TP
.BI \-m\ mode .BI \-m,\ --exe-mode= mode
Set the executable mode, which can be one of the following: Set the executable mode, which can be one of the following:
.br .br
.B cui .B cui
@ -161,16 +161,16 @@ passed to the entry point.
.br .br
This option is only meaningful in \fB--exe\fR mode. This option is only meaningful in \fB--exe\fR mode.
.TP .TP
.BI \-N\ dllname .BI \-N,\ --dll-name= dllname
Set the internal name of the module. It is only used in Win16 Set the internal name of the module. It is only used in Win16
modules. The default is to use the base name of the spec file (without modules. The default is to use the base name of the spec file (without
any extension). This is used for KERNEL, since it lives in any extension). This is used for KERNEL, since it lives in
KRNL386.EXE. It shouldn't be needed otherwise. KRNL386.EXE. It shouldn't be needed otherwise.
.TP .TP
.BI \-o\ file .BI \-o,\ --output= file
Set the name of the output file (default is standard output). Set the name of the output file (default is standard output).
.TP .TP
.BI \-r\ rsrc.res .BI \-r,\ --res= rsrc.res
Load resources from the specified binary resource file. The Load resources from the specified binary resource file. The
\fIrsrc.res\fR can be produced from a source resource file with \fIrsrc.res\fR can be produced from a source resource file with
.BR wrc(1) .BR wrc(1)
@ -183,7 +183,10 @@ and will automatically be handled correctly (though the
.B \-r .B \-r
option will also work for Win32 files). option will also work for Win32 files).
.TP .TP
.B \-w .B \--version
Display the program version and exit.
.TP
.B \-w, --warnings
Turn on warnings. Turn on warnings.
.SH "SPEC FILE SYNTAX" .SH "SPEC FILE SYNTAX"
.SS "General syntax" .SS "General syntax"