home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 5 / CD_Magazyn_EXEC_nr_5.iso / Programy / Programowanie / vbcc07e.lzx / vbcc / doc / building.doc < prev    next >
Encoding:
Text File  |  2001-02-12  |  5.3 KB  |  169 lines

  1. vbcc - C compiler (c) in 1995-99 by Volker Barthelmann
  2.  
  3.  
  4. INTRODUCTION
  5.  
  6.     vbcc is a portable and retargetable ANSI C compiler.
  7.     It is split into a target independant and a target dependant part and
  8.     supports emulating datatypes of the target machine on any other machine
  9.     so that it is possible to e.g. make a crosscompiler for a 64bit machine
  10.     on a 32bit machine.
  11.  
  12.     This document only deals with building vbcc from the source.
  13.     Be sure to read all the documents for your machine.
  14.  
  15.  
  16. LEGAL
  17.  
  18.     vbcc is (c) in 1995-2000 by Volker Barthelmann. 
  19.     This is a development snapshot which must not be distributed.
  20.     Also, commercial usage is forbidden.
  21.  
  22.  
  23. DIRECTORY-STRUCTURE
  24.  
  25.     The vbcc-directory contains the following important files and
  26.     directories:
  27.  
  28.     vbcc/                   The main directory.
  29.     vbcc/Makefile           The Makefile used to build vbcc.
  30.     vbcc/frontend/          Directory containing the source to vc.
  31.     vbcc/vsc/               Directory containing source to vsc.
  32.     vbcc/machines/target/   Directory for <target>.
  33.     vbcc/bin/               Directory the executables will be placed in.
  34.  
  35.     All compiling is done from the main directory.
  36.     The frontend vc is not target-dependend and therefore only one version
  37.     is created.
  38.  
  39.     Every available target has at least one subdirectory with its name in
  40.     vbcc/ and contains at least the files machine.h, machine.c and
  41.     machine.dt. Target-specific object-files will also be stored in that
  42.     directory.
  43.  
  44.     The executables will be placed in vbcc/bin/. The main compiler will
  45.     be called vbcc<target>.
  46.  
  47.  
  48. ADAPTING THE MAKEFILE
  49.  
  50.     Before building anything you have to insert correct values for CC, NCC,
  51.     LDFLAGS and NLDFLAGS in the Makefile.
  52.  
  53.     CC       Here you have to insert a command that invokes an ANSI C
  54.              compiler you want to use to build vbcc. It must support
  55.              -D, -I, -c and -o the same like e.g. vc or gcc.
  56.              Additional options should also be inserted here. E.g. if you
  57.              are compiling for the Amiga with vbcc you should add -DAMIGA.
  58.  
  59.     LDFLAGS  Here you have to add options which are necessary for linking.
  60.              E.g. some compilers need special libraries for floating-point.
  61.  
  62.     An example for the Amiga using vbcc would be:
  63.  
  64.       CC = vbcc://bin/vc -DAMIGA
  65.       LDFLAGS = -lmieee
  66.  
  67.     An example for a typical Unix-installation would be:
  68.  
  69.       CC = cc
  70.       LDFLAGS = -lm
  71.  
  72.     NCC and NLDFLAGS are similar to CC and LDFLAGS but they must always
  73.     describe a native compiler, i.e. Programs compiled with NCC/NLDFLAGS
  74.     must be executable on the host system. This is needed because during
  75.     the build programs may have to be executed on the host.
  76.  
  77.  
  78. BUILDING vc
  79.  
  80.     Type:
  81.  
  82.       make bin/vc
  83.  
  84.  
  85. BUILDING vsc
  86.  
  87.     Type:
  88.  
  89.       make TARGET=<target> bin/vsc<target>
  90.  
  91.     E.g.:
  92.  
  93.       make TARGET=alpha bin/vscalpha
  94.  
  95.     Omit this step if there is no file machines/<target>/schedule.c.
  96.  
  97.  
  98. BUILDING vbcc
  99.  
  100.     Type:
  101.  
  102.       make TARGET=<target> bin/vbcc<target>
  103.  
  104.     E.g.:
  105.  
  106.       make TARGET=alpha bin/vbccalpha
  107.  
  108.     During the build the program dtgen will be generated and executed on
  109.     the host-system. First it will ask you whether you are building a
  110.     cross-compiler.
  111.  
  112.     Answer 'y' only if you are building a cross-compiler (i.e. a compiler
  113.     which does not produce code for the same machine it it running on).
  114.  
  115.     Note that it does _not_ matter if you are cross-building a compiler,
  116.     i.e. if you are running on system A and building a B->B compiler
  117.     by using an A->B compiler then you can answer 'n'.
  118.  
  119.     If you answered 'y' you will be asked if your system/compiler offers
  120.     certain datatypes. This refers to the compiler you described with
  121.     CC in the Makefile.
  122.     E.g. if CC is an A->B cross-compiler you have to answer the questions
  123.     according to B.
  124.     To each question answer 'y' or 'n' depending if such a datatype is
  125.     available on that compiler. If you answered 'y' you have to type in
  126.     the name of that type on the compiler (e.g. "signed int", "unsigned
  127.     char" etc.).
  128.     If there are not enough datatypes available to build vbcc an error
  129.     message will be printed and the build aborts.
  130.  
  131.  
  132. CONFIGURING
  133.  
  134.     See vc.doc, vsc<target>.doc and vbcc<target>.doc for information on
  135.     how to create the necessary config-files.
  136.  
  137.  
  138. BUILDING CROSS-COMPILERS
  139.  
  140.     As there is often confusion when it comes to cross-building compilers
  141.     or building cross-compilers, here is what has to be done to cross-build
  142.     a B->C cross-compiler on system A with only a native A->A compiler
  143.     available.
  144.  
  145.     This is done by first building an A->B compiler and then cross-building
  146.     the B->C compiler using the A->B compiler.
  147.  
  148.     For the first step you use the A->A compiler for CC as well as NCC.
  149.     Now you type:
  150.  
  151.       make bin/vc
  152.       make TARGET=B bin/vscB   # omit if there is no machines/B/schedule.c
  153.       make TARGET=B bin/vbccB
  154.  
  155.     The questions about datatypes are answered according to A.
  156.     Then you should write a vc.config for the vbccB cross-compiler.
  157.  
  158.     Now create a second directory containing all the sources to vbcc and
  159.     set CC/LDFLAGS to vc using the config-file for vbccB and NCC/NLDFLAGS
  160.     to the A->A compiler. Type:
  161.  
  162.       make bin/vc
  163.       make TARGET=C bin/vscC   # omit if there is no machines/C/schedule.c
  164.       make TARGET=C bin/vbccC
  165.  
  166.  
  167. Volker Barthelmann                                      vb@compilers.de
  168.  
  169.