Compiling the compiler

Compiling the compiler can be done with one statement. It’s always best to remove all units from the compiler directory first, so something like

 rm *.ppu *.o
on LINUX, and on DOS
 del *.ppu
 del *.o
After this, the compiler can be compiled with the following command-line:
 ppc386 -Tlinux  -Fu../rtl/linux -di386 -dGDB pp.pas
So, the minimum options are:
  1. The target OS. Can be skipped when compiling for the same target as the compiler which is being used.
  2. A path to an RTL. Can be skipped if a correct fpc.cfg configuration is on the system. If the compiler should be compiled with the RTL that was compiled first, this should be ../rtl/OS (replace the OS with the appropriate operating system subdirectory of the RTL).
  3. A define with the processor for which the compiler is compiled for. Required.
  4. -dGDB. Required.
  5. -Sg is needed, some parts of the compiler use goto statements (to be specific: the scanner).

So the absolute minimal command line is

 ppc386 -di386 -dGDB -Sg pp.pas

Some other command-line options can be used, but the above are the minimum. A list of recognised options can be found in table (F.1).



Table F.1: Possible defines when compiling FPC
Define does what


TP Needed to compile the compiler with Turbo or Borland Pascal.
GDB Support of the GNU Debugger (required switch).
I386 Generate a compiler for the Intel i386+ processor family.
M68K Generate a compiler for the M680x0 processor family.
EXTDEBUG Some extra debug code is executed.
MEMDEBUG Some memory usage information is displayed.
SUPPORT_MMX only i386: enables the compiler switch MMX which
allows the compiler to generate MMX instructions.
EXTERN_MSG Don’t compile the msgfiles in the compiler, always use
external messagefiles (default for TP).
LOGSECONDPASS Write compiler node information in assembler output.
NOOPT Do not include the optimizer in the compiler.



This list may be subject to change, the source file pp.pas always contains an up-to-date list.