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

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