History

update options

bellard committed 24 years ago

Commit f75e0c61 parent a50e58e1 file · +87 −12Browse files

Unified · Split

tcc-doc.texi+87−12
@@ -33,11 +33,78 @@ generation (@xref{libtcc}). · 32 unmodified lines
33@node invoke33@node invoke
34@chapter Command line invocation34@chapter Command line invocation
35 35
36@section Quick start
37
38@example
39usage: tcc [-c] [-o outfile] [-bench] [-Idir] [-Dsym[=val]] [-Usym]
40 [-g] [-b] [-llib] [-shared] [-static]
41 [--] infile1 [infile2... --] [infile_args...]
42@end example
43
44TCC options are a very much like gcc. The main difference is that TCC
45can also execute directly the resulting program and give it runtime
46arguments.
47
48Here are some examples to understand the logic:
49
50@table @code
51@item tcc a.c
52Compile a.c and execute it directly
53
54@item tcc a.c arg1
55Compile a.c and execute it directly. arg1 is given as first argument to
56the @code{main()} of a.c.
57
58@item tcc -- a.c b.c -- arg1
59Compile a.c and b.c, link them together and execute them. arg1 is given
60as first argument to the @code{main()} of the resulting program. Because
61multiple C files are specified, @code{--} are necessary to clearly separate the
62program arguments from the TCC options.
63
64@item tcc -o myprog a.c b.c
65Compile a.c and b.c, link them and generate the executable myprog.
66
67@item tcc -o myprog a.o b.o
68link a.o and b.o together and generate the executable myprog.
69
70@item tcc -c -o a.o a.c
71Compile a.c and generate object file a.o
72
73@end table
74
75Scripting:
76
77TCC can be invoked from @emph{scripts}, just as shell scripts. You just
78need to add @code{#!/usr/local/bin/tcc} at the start of your C source:
79
36@example80@example
37usage: tcc [-Idir] [-Dsym[=val]] [-Usym] [-llib] [-g] [-b]81#!/usr/local/bin/tcc
38 [-i infile] infile [infile_args...]82#include <stdio.h>
83
84int main()
85{
86 printf("Hello World\n");
87 return 0;
88}
39@end example89@end example
40 90
91@section Option summary
92
93General Options:
94
95@table @samp
96@item -c
97Generate an object file (@samp{-o} option must also be given).
98
99@item -o outfile
100Put object file, executable, or dll into output file @file{outfile}.
101
102@item -bench
103Output compilation statistics
104@end table
105
106Preprocessor options:
107
41@table @samp108@table @samp
42@item -Idir109@item -Idir
43Specify an additionnal include path. The default ones are:110Specify an additionnal include path. The default ones are:
@@ -51,12 +118,11 @@ also be defined: @code{'-DF(a)=a+1'} · 7 unmodified lines
51 118
52@item -Usym119@item -Usym
53Undefine preprocessor symbol 'sym'.120Undefine preprocessor symbol 'sym'.
121@end table
54 122
55@item -lxxx123C compiler options:
56Dynamically link your program with library
57libxxx.so. Standard library paths are checked, including those
58specified with LD_LIBRARY_PATH.
59 124
125@table @samp
60@item -g126@item -g
61Generate run time debug information so that you get clear run time127Generate run time debug information so that you get clear run time
62error messages: @code{ test.c:68: in function 'test5()': dereferencing128error messages: @code{ test.c:68: in function 'test5()': dereferencing
@@ -67,15 +133,24 @@ fault}. · 4 unmodified lines
67Generate additionnal support code to check133Generate additionnal support code to check
68memory allocations and array/pointer bounds. '-g' is implied. Note134memory allocations and array/pointer bounds. '-g' is implied. Note
69that the generated code is slower and bigger in this case.135that the generated code is slower and bigger in this case.
136@end table
70 137
71@item -i file138Linker options:
72Compile C source 'file' before main C source. With this
73command, multiple C files can be compiled and linked together.
74 139
75@end table140@table @samp
141@item -lxxx
142Dynamically link your program with library
143libxxx.so. Standard library paths are checked, including those
144specified with LD_LIBRARY_PATH.
145
146@item -shared
147Generate a shared library instead of an executable (@samp{-o} option must also be given).
76 148
77Note: the @code{-o file} option to generate an ELF executable is149@item -static
78currently unsupported.150Generate a statically linked executable (default is a shared linked
151executable) (@samp{-o} option must also be given).
152
153@end table
79 154
80@chapter C language support155@chapter C language support
81 156

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t