forked from Mirrors/tinycc
tcc -hh: show more options
parent
2d3b9559bf
commit
5286529632
4
libtcc.c
4
libtcc.c
|
@ -1436,6 +1436,7 @@ typedef struct TCCOption {
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
TCC_OPTION_HELP,
|
TCC_OPTION_HELP,
|
||||||
|
TCC_OPTION_HELP2,
|
||||||
TCC_OPTION_v,
|
TCC_OPTION_v,
|
||||||
TCC_OPTION_I,
|
TCC_OPTION_I,
|
||||||
TCC_OPTION_D,
|
TCC_OPTION_D,
|
||||||
|
@ -1494,6 +1495,7 @@ static const TCCOption tcc_options[] = {
|
||||||
{ "h", TCC_OPTION_HELP, 0 },
|
{ "h", TCC_OPTION_HELP, 0 },
|
||||||
{ "-help", TCC_OPTION_HELP, 0 },
|
{ "-help", TCC_OPTION_HELP, 0 },
|
||||||
{ "?", TCC_OPTION_HELP, 0 },
|
{ "?", TCC_OPTION_HELP, 0 },
|
||||||
|
{ "hh", TCC_OPTION_HELP2, 0 },
|
||||||
{ "v", TCC_OPTION_v, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
{ "v", TCC_OPTION_v, TCC_OPTION_HAS_ARG | TCC_OPTION_NOSEP },
|
||||||
{ "I", TCC_OPTION_I, TCC_OPTION_HAS_ARG },
|
{ "I", TCC_OPTION_I, TCC_OPTION_HAS_ARG },
|
||||||
{ "D", TCC_OPTION_D, TCC_OPTION_HAS_ARG },
|
{ "D", TCC_OPTION_D, TCC_OPTION_HAS_ARG },
|
||||||
|
@ -1726,6 +1728,8 @@ reparse:
|
||||||
switch(popt->index) {
|
switch(popt->index) {
|
||||||
case TCC_OPTION_HELP:
|
case TCC_OPTION_HELP:
|
||||||
return OPT_HELP;
|
return OPT_HELP;
|
||||||
|
case TCC_OPTION_HELP2:
|
||||||
|
return OPT_HELP2;
|
||||||
case TCC_OPTION_I:
|
case TCC_OPTION_I:
|
||||||
tcc_add_include_path(s, optarg);
|
tcc_add_include_path(s, optarg);
|
||||||
break;
|
break;
|
||||||
|
|
181
tcc.c
181
tcc.c
|
@ -25,83 +25,128 @@
|
||||||
#endif
|
#endif
|
||||||
#include "tcctools.c"
|
#include "tcctools.c"
|
||||||
|
|
||||||
static void help(void)
|
static const char help[] =
|
||||||
{
|
"Tiny C Compiler "TCC_VERSION" - Copyright (C) 2001-2006 Fabrice Bellard\n"
|
||||||
printf("Tiny C Compiler "TCC_VERSION" - Copyright (C) 2001-2006 Fabrice Bellard\n"
|
"Usage: tcc [options...] [-o outfile] [-c] infile(s)...\n"
|
||||||
"Usage: tcc [options...] [-o outfile] [-c] infile(s)...\n"
|
" tcc [options...] -run infile [arguments...]\n"
|
||||||
" tcc [options...] -run infile [arguments...]\n"
|
"General options:\n"
|
||||||
"General options:\n"
|
" -c compile only - generate an object file\n"
|
||||||
" -c compile only - generate an object file\n"
|
" -o outfile set output filename\n"
|
||||||
" -o outfile set output filename\n"
|
" -run run compiled source\n"
|
||||||
" -run run compiled source\n"
|
" -fflag set or reset (with 'no-' prefix) 'flag' (see tcc -hh)\n"
|
||||||
" -fflag set or reset (with 'no-' prefix) 'flag' (see man page)\n"
|
" -Wwarning set or reset (with 'no-' prefix) 'warning' (see tcc -hh)\n"
|
||||||
" -Wwarning set or reset (with 'no-' prefix) 'warning' (see man page)\n"
|
" -w disable all warnings\n"
|
||||||
" -w disable all warnings\n"
|
" -v -vv show version, show search paths or loaded files\n"
|
||||||
" -v show version\n"
|
" -h -hh show this, show more help\n"
|
||||||
" -vv show included files (as sole argument show search paths)\n"
|
" -bench show compilation statistics\n"
|
||||||
" -h show this help\n"
|
" - use stdin pipe as infile\n"
|
||||||
" -bench show compilation statistics\n"
|
" @listfile read arguments from listfile\n"
|
||||||
"Preprocessor options:\n"
|
"Preprocessor options:\n"
|
||||||
" -Idir add include path 'dir'\n"
|
" -Idir add include path 'dir'\n"
|
||||||
" -Dsym[=val] define 'sym' with value 'val'\n"
|
" -Dsym[=val] define 'sym' with value 'val'\n"
|
||||||
" -Usym undefine 'sym'\n"
|
" -Usym undefine 'sym'\n"
|
||||||
" -E preprocess only\n"
|
" -E preprocess only\n"
|
||||||
" -P[1] no / alternative #line output with -E\n"
|
"Linker options:\n"
|
||||||
" -dD -dM output #define directives with -E\n"
|
" -Ldir add library path 'dir'\n"
|
||||||
" -include file include file above each input file\n"
|
" -llib link with dynamic or static library 'lib'\n"
|
||||||
"Linker options:\n"
|
" -r generate (relocatable) object file\n"
|
||||||
" -Ldir add library path 'dir'\n"
|
" -shared generate a shared library/dll\n"
|
||||||
" -llib link with dynamic or static library 'lib'\n"
|
" -rdynamic export all global symbols to dynamic linker\n"
|
||||||
" -r generate (relocatable) object file\n"
|
" -soname set name for shared library to be used at runtime\n"
|
||||||
" -shared generate a shared library\n"
|
" -Wl,-opt[=val] set linker option (see tcc -hh)\n"
|
||||||
" -rdynamic export all global symbols to dynamic linker\n"
|
"Debugger options:\n"
|
||||||
" -soname set name for shared library to be used at runtime\n"
|
" -g generate runtime debug info\n"
|
||||||
" -static static linking\n"
|
|
||||||
" -pthread link with -lpthread and -D_REENTRANT (POSIX Linux)\n"
|
|
||||||
" -Wl,-opt[=val] set linker option (see manual)\n"
|
|
||||||
"Debugger options:\n"
|
|
||||||
" -g generate runtime debug info\n"
|
|
||||||
#ifdef CONFIG_TCC_BCHECK
|
#ifdef CONFIG_TCC_BCHECK
|
||||||
" -b compile with built-in memory and bounds checker (implies -g)\n"
|
" -b compile with built-in memory and bounds checker (implies -g)\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_TCC_BACKTRACE
|
#ifdef CONFIG_TCC_BACKTRACE
|
||||||
" -bt N show N callers in stack traces\n"
|
" -bt N show N callers in stack traces\n"
|
||||||
#endif
|
#endif
|
||||||
"Misc options:\n"
|
"Misc. options:\n"
|
||||||
" -x[c|a|n] specify type of the next infile\n"
|
" -x[c|a|n] specify type of the next infile\n"
|
||||||
" -nostdinc do not use standard system include paths\n"
|
" -nostdinc do not use standard system include paths\n"
|
||||||
" -nostdlib do not link with standard crt and libraries\n"
|
" -nostdlib do not link with standard crt and libraries\n"
|
||||||
" -Bdir use 'dir' as tcc's private library/include path\n"
|
" -Bdir set tcc's private include/library dir\n"
|
||||||
" -MD generate target dependencies for make\n"
|
" -MD generate dependency file for make\n"
|
||||||
" -MF depfile put generated dependencies here\n"
|
" -MF file specify dependency file name\n"
|
||||||
" -dumpversion print version\n"
|
" -m32/64 defer to i386/x86_64 cross compiler\n"
|
||||||
" - use stdin pipe as infile\n"
|
"Tools:\n"
|
||||||
" @listfile read arguments from listfile\n"
|
" create library : tcc -ar [rcsv] lib.a files\n"
|
||||||
"Target specific options:\n"
|
#ifdef TCC_TARGET_PE
|
||||||
" -m32/64 execute i386/x86-64 cross compiler\n"
|
" create def file : tcc -impdef lib.dll [-v] [-o lib.def]\n"
|
||||||
" -mms-bitfields use MSVC bitfield layout\n"
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
|
static const char help2[] =
|
||||||
|
"Tiny C Compiler "TCC_VERSION" - More Options\n"
|
||||||
|
"Special options:\n"
|
||||||
|
" -P -P1 with -E: no/alternative #line output\n"
|
||||||
|
" -dD -dM with -E: output #define directives\n"
|
||||||
|
" -pthread same as -D_REENTRANT and -lpthread\n"
|
||||||
|
" -On same as -D__OPTIMIZE__ for n > 0\n"
|
||||||
|
" -Wp,-opt same as -opt\n"
|
||||||
|
" -include file include 'file' above each input file\n"
|
||||||
|
" -isystem dir add 'dir' to system include path\n"
|
||||||
|
" -iwithprefix dir set tcc's private include/library subdir\n"
|
||||||
|
" -static link to static libraries (not recommended)\n"
|
||||||
|
" -dumpversion print version\n"
|
||||||
|
" -print-search-dirs print search paths\n"
|
||||||
|
"Ignored options:\n"
|
||||||
|
" --param -pedantic -pipe -s -std -traditional\n"
|
||||||
|
"-W... warnings:\n"
|
||||||
|
" all turn on some (*) warnings\n"
|
||||||
|
" error stop after first warning\n"
|
||||||
|
" unsupported warn about ignored options, pragmas, etc.\n"
|
||||||
|
" write-strings strings are const\n"
|
||||||
|
" implicit-function-declaration warn for missing prototype (*)\n"
|
||||||
|
"-f[no-]... flags:\n"
|
||||||
|
" unsigned-char default char is unsigned\n"
|
||||||
|
" signed-char default char is signed\n"
|
||||||
|
" common use common section instead of bss\n"
|
||||||
|
" leading-underscore decorate extern symbols\n"
|
||||||
|
" ms-extensions allow struct w/o identifier\n"
|
||||||
|
" dollars-in-identifiers allow '$' in C symbols\n"
|
||||||
|
" old-struct-init-code some hack for parsing initializers\n"
|
||||||
|
"-m... target specific options:\n"
|
||||||
|
" ms-bitfields use MSVC bitfield layout\n"
|
||||||
#ifdef TCC_TARGET_ARM
|
#ifdef TCC_TARGET_ARM
|
||||||
" -mfloat-abi hard/softfp on arm\n"
|
" float-abi hard/softfp on arm\n"
|
||||||
#endif
|
#endif
|
||||||
#ifdef TCC_TARGET_X86_64
|
#ifdef TCC_TARGET_X86_64
|
||||||
" -mno-sse disable floats on x86-64\n"
|
" no-sse disable floats on x86_64\n"
|
||||||
#endif
|
#endif
|
||||||
"Tools:\n"
|
"-Wl,... linker options:\n"
|
||||||
" create library : tcc -ar [rcsv] lib.a files\n"
|
" -nostdlib do not link with standard crt/libs\n"
|
||||||
|
" -[no-]whole-archive load lib(s) fully/only as needed\n"
|
||||||
|
" -image-base= -Ttext= set base address of executable\n"
|
||||||
|
" -section-alignment= set section alignment in executable\n"
|
||||||
#ifdef TCC_TARGET_PE
|
#ifdef TCC_TARGET_PE
|
||||||
" create .def file : tcc -impdef lib.dll [-v] [-o lib.def]\n"
|
" -file-alignment= set PE file alignment\n"
|
||||||
|
" -stack= set PE stack reserve\n"
|
||||||
|
" -large-address-aware set related PE option\n"
|
||||||
|
" -subsystem=[console gui] set PE subsystem\n"
|
||||||
|
" -oformat=[pe-* binary] set executable output format\n"
|
||||||
|
"Predefined macros:\n"
|
||||||
|
" tcc -E -dM - < nul\n"
|
||||||
|
#else
|
||||||
|
" -rpath= set dynamic library seach path\n"
|
||||||
|
" -enable-new-dtags set DT_RUNPATH instead of DT_RPATH\n"
|
||||||
|
" -soname= set DT_SONAME elf tag\n"
|
||||||
|
" -Bsymbolic set DT_SYMBOLIC elf tag\n"
|
||||||
|
" -oformat=[elf32/64-* binary] set executable output format\n"
|
||||||
|
" -init= -fini= -as-needed -O (ignored)\n"
|
||||||
|
"Predefined macros:\n"
|
||||||
|
" tcc -E -dM - < /dev/null\n"
|
||||||
#endif
|
#endif
|
||||||
);
|
"See also the manual for more details.\n"
|
||||||
}
|
;
|
||||||
|
|
||||||
|
static const char version[] =
|
||||||
static void version(void)
|
"tcc version "TCC_VERSION" ("
|
||||||
{
|
|
||||||
printf("tcc version %s ("
|
|
||||||
#ifdef TCC_TARGET_I386
|
#ifdef TCC_TARGET_I386
|
||||||
"i386"
|
"i386"
|
||||||
#elif defined TCC_TARGET_X86_64
|
#elif defined TCC_TARGET_X86_64
|
||||||
"x86-64"
|
"x86_64"
|
||||||
#elif defined TCC_TARGET_C67
|
#elif defined TCC_TARGET_C67
|
||||||
"C67"
|
"C67"
|
||||||
#elif defined TCC_TARGET_ARM
|
#elif defined TCC_TARGET_ARM
|
||||||
|
@ -133,8 +178,8 @@ static void version(void)
|
||||||
#else
|
#else
|
||||||
" Unidentified system"
|
" Unidentified system"
|
||||||
#endif
|
#endif
|
||||||
")\n", TCC_VERSION);
|
")\n"
|
||||||
}
|
;
|
||||||
|
|
||||||
static void print_dirs(const char *msg, char **paths, int nb_paths)
|
static void print_dirs(const char *msg, char **paths, int nb_paths)
|
||||||
{
|
{
|
||||||
|
@ -205,11 +250,13 @@ redo:
|
||||||
|
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
if (opt == OPT_HELP)
|
if (opt == OPT_HELP)
|
||||||
return help(), 1;
|
return printf(help), 1;
|
||||||
|
if (opt == OPT_HELP2)
|
||||||
|
return printf(help2), 1;
|
||||||
if (opt == OPT_M32 || opt == OPT_M64)
|
if (opt == OPT_M32 || opt == OPT_M64)
|
||||||
tcc_tool_cross(s, argv, opt); /* never returns */
|
tcc_tool_cross(s, argv, opt); /* never returns */
|
||||||
if (s->verbose)
|
if (s->verbose)
|
||||||
version();
|
printf(version);
|
||||||
if (opt == OPT_AR)
|
if (opt == OPT_AR)
|
||||||
return tcc_tool_ar(s, argc, argv);
|
return tcc_tool_ar(s, argc, argv);
|
||||||
#ifdef TCC_TARGET_PE
|
#ifdef TCC_TARGET_PE
|
||||||
|
|
1
tcc.h
1
tcc.h
|
@ -1157,6 +1157,7 @@ ST_FUNC char *normalize_slashes(char *path);
|
||||||
|
|
||||||
/* tcc_parse_args return codes: */
|
/* tcc_parse_args return codes: */
|
||||||
#define OPT_HELP 1
|
#define OPT_HELP 1
|
||||||
|
#define OPT_HELP2 2
|
||||||
#define OPT_V 3
|
#define OPT_V 3
|
||||||
#define OPT_PRINT_DIRS 4
|
#define OPT_PRINT_DIRS 4
|
||||||
#define OPT_AR 5
|
#define OPT_AR 5
|
||||||
|
|
Loading…
Reference in New Issue