Redo "fix line number in macro redefined message"
[tinycc.git] / README.md
blobb1af8e42b56e66f2c4266de16eebf614a326bf55
1 **TinyCC** (or tcc) is short for Tiny C Compiler.
3 This a clone of the mob development repo at http://repo.or.cz/tinycc.git
5 |Branch      |Status   |
6 |------------|---------|
7 |mob         | [![Build Status](https://travis-ci.org/wqweto/tinycc.svg?branch=mob)](https://travis-ci.org/wqweto/tinycc) |
8 |dev         | [![Build Status](https://travis-ci.org/wqweto/tinycc.svg?branch=dev)](https://travis-ci.org/wqweto/tinycc) | 
10 ### License
12 Tiny C Compiler project is licensed under [LGPL](https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License) but currently there is an effort to relicense the project under [MIT License](https://en.wikipedia.org/wiki/MIT_License). See RELICENSING file in root for current status.
14 ### Branch Policy
16 The "dev" branch is the one where all contributions will be merged before reaching "mob". If you plan to propose a patch, please commit into the "dev" branch or its own feature branch. Direct commit to "mob" are not permitted.
18 ### Original Fabrice Bellard readme
20 ```
21 Tiny C Compiler - C Scripting Everywhere - The Smallest ANSI C compiler
22 -----------------------------------------------------------------------
24 Features:
25 --------
27 - SMALL! You can compile and execute C code everywhere, for example on
28   rescue disks.
30 - FAST! tcc generates optimized x86 code. No byte code
31   overhead. Compile, assemble and link about 7 times faster than 'gcc
32   -O0'.
34 - UNLIMITED! Any C dynamic library can be used directly. TCC is
35   heading torward full ISOC99 compliance. TCC can of course compile
36   itself.
38 - SAFE! tcc includes an optional memory and bound checker. Bound
39   checked code can be mixed freely with standard code.
41 - Compile and execute C source directly. No linking or assembly
42   necessary. Full C preprocessor included. 
44 - C script supported : just add '#!/usr/local/bin/tcc -run' at the first
45   line of your C source, and execute it directly from the command
46   line.
48 Documentation:
49 -------------
51 1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host (for Windows read tcc-win32.txt)
53 Note: For OSX and FreeBSD, gmake should be used instead of make.
55    ./configure
56    make
57    make test
58    make install
60 Alternatively, out-of-tree builds are supported: you may use different
61 directories to hold build objects, kept separate from your source tree:
63    mkdir _build
64    cd _build
65    ../configure
66    make
67    make test
68    make install
70 Texi2html must be installed to compile the doc. 
71 By default, tcc is installed in /usr/local/bin.
72 ./configure --help  shows configuration options.
75 2) Introduction
77 We assume here that you know ANSI C. Look at the example ex1.c to know
78 what the programs look like.
80 The include file <tcclib.h> can be used if you want a small basic libc
81 include support (especially useful for floppy disks). Of course, you
82 can also use standard headers, although they are slower to compile.
84 You can begin your C script with '#!/usr/local/bin/tcc -run' on the first
85 line and set its execute bits (chmod a+x your_script). Then, you can
86 launch the C code as a shell or perl script :-) The command line
87 arguments are put in 'argc' and 'argv' of the main functions, as in
88 ANSI C.
90 3) Examples
92 ex1.c: simplest example (hello world). Can also be launched directly
93 as a script: './ex1.c'.
95 ex2.c: more complicated example: find a number with the four
96 operations given a list of numbers (benchmark).
98 ex3.c: compute fibonacci numbers (benchmark).
100 ex4.c: more complicated: X11 program. Very complicated test in fact
101 because standard headers are being used ! As for ex1.c, can also be launched
102 directly as a script: './ex4.c'.
104 ex5.c: 'hello world' with standard glibc headers.
106 tcc.c: TCC can of course compile itself. Used to check the code
107 generator.
109 tcctest.c: auto test for TCC which tests many subtle possible bugs. Used
110 when doing 'make test'.
112 4) Full Documentation
114 Please read tcc-doc.html to have all the features of TCC.
116 Additional information is available for the Windows port in tcc-win32.txt.
118 License:
119 -------
121 TCC is distributed under the GNU Lesser General Public License (see
122 COPYING file).
124 Fabrice Bellard.