F.3.2 Compiling for another target

When compiling the compiler for another target, it is necessary to specify the OS_TARGET makefile variable. It can be set to the following values: win32, go32v2, os2 and linux. As an example, cross-compilation for the go32v2 target from the win32 target is chosen:

cd compiler  
make cycle OS_TARGET=go32v2

This will compile the go32v2 RTL, and compile a go32v2 compiler.

When compiling a new compiler and the compiler should be compiled using an existing compiled RTL, the all target must be used, and another RTL directory than the default (which is the ../rtl/$(OS_TARGET) directory) must be indicated. For instance, assuming that the compiled RTL units are in /pp/rtl/units/i386-linux, typing

cd compiler  
make clean  
make all UNITDIR=/pp/rtl/units/i386-linux

should use the RTL from the /pp/rtl/units/i386-linux directory.

This will then compile the compiler using the RTL units in /pp/rtl/units/i386-linux. After this has been done, the ’make cycle’ can be used, starting with this compiler:

make cycle PP=./ppc386

This will do the make cycle from above, but will start with the compiler that was generated by the make all instruction.

In all cases, many options can be passed to make to influence the compile process. In general, the makefiles add any needed compiler options to the command line, so that the RTL and compiler can be compiled. Additional options (e.g. optimization options) can be specified by passing them in OPT.