README 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. Tiny C Compiler - C Scripting Everywhere - The Smallest ANSI C compiler
  2. -----------------------------------------------------------------------
  3. Features:
  4. --------
  5. - SMALL! You can compile and execute C code everywhere, for example on
  6. rescue disks.
  7. - FAST! tcc generates optimized x86 code. No byte code
  8. overhead. Compile, assemble and link about 7 times faster than 'gcc
  9. -O0'.
  10. - UNLIMITED! Any C dynamic library can be used directly. TCC is
  11. heading torward full ISOC99 compliance. TCC can of course compile
  12. itself.
  13. - SAFE! tcc includes an optional memory and bound checker. Bound
  14. checked code can be mixed freely with standard code.
  15. - Compile and execute C source directly. No linking or assembly
  16. necessary. Full C preprocessor included.
  17. - C script supported : just add '#!/usr/local/bin/tcc -run' at the first
  18. line of your C source, and execute it directly from the command
  19. line.
  20. Documentation:
  21. -------------
  22. 1) Installation on a i386/x86_64/arm Linux/OSX/FreeBSD host
  23. ./configure
  24. make
  25. make test
  26. make install
  27. Notes: For OSX and FreeBSD, gmake should be used instead of make.
  28. For Windows read tcc-win32.txt.
  29. makeinfo must be installed to compile the doc. By default, tcc is
  30. installed in /usr/local/bin. ./configure --help shows configuration
  31. options.
  32. 2) Introduction
  33. We assume here that you know ANSI C. Look at the example ex1.c to know
  34. what the programs look like.
  35. The include file <tcclib.h> can be used if you want a small basic libc
  36. include support (especially useful for floppy disks). Of course, you
  37. can also use standard headers, although they are slower to compile.
  38. You can begin your C script with '#!/usr/local/bin/tcc -run' on the first
  39. line and set its execute bits (chmod a+x your_script). Then, you can
  40. launch the C code as a shell or perl script :-) The command line
  41. arguments are put in 'argc' and 'argv' of the main functions, as in
  42. ANSI C.
  43. 3) Examples
  44. ex1.c: simplest example (hello world). Can also be launched directly
  45. as a script: './ex1.c'.
  46. ex2.c: more complicated example: find a number with the four
  47. operations given a list of numbers (benchmark).
  48. ex3.c: compute fibonacci numbers (benchmark).
  49. ex4.c: more complicated: X11 program. Very complicated test in fact
  50. because standard headers are being used ! As for ex1.c, can also be launched
  51. directly as a script: './ex4.c'.
  52. ex5.c: 'hello world' with standard glibc headers.
  53. tcc.c: TCC can of course compile itself. Used to check the code
  54. generator.
  55. tcctest.c: auto test for TCC which tests many subtle possible bugs. Used
  56. when doing 'make test'.
  57. 4) Full Documentation
  58. Please read tcc-doc.html to have all the features of TCC.
  59. Additional information is available for the Windows port in tcc-win32.txt.
  60. License:
  61. -------
  62. TCC is distributed under the GNU Lesser General Public License (see
  63. COPYING file).
  64. Fabrice Bellard.