This is a guide to installing the c68/c386 compiler on your system. Using standard MINIX stdio with c68/c386 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The standard MINIX distribution is missing the library routine vfprintf() which is required to build c68/c386. A version of this routine that is useable with the standard MINIX stdio routines is supplied with the c68/c386 source. If required it should be built and installed into your C library. Building the Compiler ~~~~~~~~~~~~~~~~~~~~~ 1. Build the relevant library support modules. To do this issue the make command in the relevant sub-directories. The sub-directories contain support files as follows: lib386 c386 support routines. lib68k c68 general support routines (needed for both MFFP and IEEE versions) libmffp c68 support routines for MFFP floating point libieee c68 support routines for IEEE floating point You only need to compile those that are in directories relevant to the version of the compiler you wish to build. When you have built the support routines in a sub-directory, you will need to add them to your C library If this is kept in /usr/lib/libc.a, then you can do this by issuing make install in the relevant sub-directories. Users of versions of c68 prior to Version 4.3 should note that the previous set of support routines have been replaced with new ones which have different names (and different entry points). Initially you should just add the new routines to your C library until you have finished building the new compiler. Once you have built the new compiler, AND also recompiled any library routines which were compiled with the c68 old compiler, you can remove the old support routines from your library. Users of the c68 compiler should also note that there are two versions of the alloca() routine in the lib68k sub-directory - one to be used if size_t is a 16 bit value, and the other if size_t is a 32 bit value. Ensure that the correct version is used to suit your system. 3. The cc command provided as standard with MINIX systems is not set up correctly to use the c386 or c68 compilers. The 'acd' compiler driver that has been posted to comp.os.minix in the past is a suitable substitute, and files suitable for driving both the c386 and the c68 variants have been posted. As a simple alternative we have also provided some shell scripts (called cc386 and cc68) that can run the compiler. If you decide to use these, examine them first as they may need minor adaptions to suit your particular system setup. Install this on your normal search path. 4. Switch to the src sub-directory and edit the config.??? file (NOT the config.h file) to suit the version of the compiler that you wish to build. These will be called: c386 config.c386 c68 config.c68 These files are copiously annottated, so it should be relatively clear what the implications of each option are. If you are not sure, then start with the settings as originally distributed. Special care needs to be taken if you are intending to build a version of c386 or c68 which supports floating point, and your current compiler does not. This process is discussed in more detail in its own section below. 5. make the compiler using one of make c68 make c386 The configuration file will then be copied to config.h and the specified version of the compiler will be generated. All you have to do is install the compiler, and it should be ready for use. 6. Install the compiler on your search path. If you are in the middle of the bootstrap process for a floating point version you may need to repeat steps 4 & 5 several times. 7. As a check it is a good idea to check that the compiler rebuilds itself successfully, and does not change any further in size. You are now ready to go! Bootstrapping Floating Point versions of c386/c68 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If your current compiler has no floating point support (eg. the 68K ACK compiler) then it is still possible to use it as the starting point to obtaining a floating point version of c386 or c68. The process involves rebuilding the compiler several times - each time an increased amount of FP support is added until finally a version which fully supports FP is created. At each stage you will need to amend some of the settings in the configuration file as identifed in the following steps: 1) Current compiler has no FP support. Configuration files settings: FLOAT_KEYWORDS defined FLOAT_IEEE undefined FLOAT_MFFP undefined FLOAT_BOOTSTRAP undefined This creates a version of c386 or c68 which has no FP support, but recognises the float and double keywords. Install this version ready for stage 2 below. 2) New compiler has no FP support, but recognises keywords. Configuration files settings: FLOAT_KEYWORDS defined FLOAT_IEEE / Define only one of these. Note that only FLOAT_MFFP \ the IEEE option is valid for c386. FLOAT_BOOTSTRAP defined This creates a version of the compiler which will generate a very limited amount of FP support - the FP support provided requires no FP support in the code generator of compiler itself. This state is not sufficient to compile user programs which require FP support, but is enough to get the compiler to the next stage. Note also that the MFFP option for c68 is no longer maintained and validated. It should work, but use it at your own risk as the IEEE option is now the preferred option for both c386 and c68). Install this version ready for stage 3 below. 3) Compiler has limited FP support. Configuration files settings: FLOAT_KEYWORDS defined FLOAT_IEEE / Define only one of these. Note that only FLOAT_MFFP \ the IEEE option is valid for c386. FLOAT_BOOTSTRAP undefined This creates a compiler which has full FP support. You are now ready to compile user programs that use FP! Using ESTDIO with c68 ~~~~~~~~~~~~~~~~~~~~~ If you want to use estdio to be able to print floating point numbers, then you will need versions of the following routines in your libc.a library: modf ldexp frexp If you do not already have these routines in your libc.a library, then versions of these routines are supplied in libmffp (for use with c68 MFFP variant) and libieee (for use with c68 IEEE variant). Note that it is important that you use the correct version of these routines for the type of floating point that you have selected. INVOCATION OF THE COMPILER ~~~~~~~~~~~~~~~~~~~~~~~~~~ Normally, you will call this compiler from a driver such as cc. This chapter gives you the necessary information to patch the internal tables of cc as to support this compiler. The compiler is basically called with two arguments, the input-file and the output-file. The input file contains PREPROCESSED C-sources and is normally the output of cpp, the C preprocessor. The output file contains the assembly language file. To compile a source, source.c, to an object file you could type the commands (this example works under MINIX-68K) /usr/lib/cpp source.c > TMPFILE.i /usr/lib/c68 TMPFILE.i TMPFILE.s rm TMPFILE.i /usr/bin/as - -o source.o TMPFILE.s rm TMPFILE.s In fact, c68 together with cpp replaces cem, opt, and cg. c68/c386 may also be given some options. The syntax is: c68