[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.7.2 Supporting Canadian Cross in Makefiles.

The main Canadian Cross issue in a `Makefile' arises when you want to use a subsidiary program to generate code or data which you will then include in your real program.

If you compile this subsidiary program using `$(CC)' in the usual way, you will not be able to run it. This is because `$(CC)' will build a program for the host system, but the program is being built on the build system.

You must instead use a compiler for the build system, rather than the host system. In the Cygnus tree, this make variable `$(CC_FOR_BUILD)' will hold a compiler for the build system.

Note that you should not include `config.h' in a file you are compiling with `$(CC_FOR_BUILD)'. The `configure' script will build `config.h' with information for the host system. However, you are compiling the file using a compiler for the build system (a native compiler). Subsidiary programs are normally simple filters which do no user interaction, and it is normally possible to write them in a highly portable fashion so that the absence of `config.h' is not crucial.

The gcc `Makefile.in' shows a complex situation in which certain files, such as `rtl.c', must be compiled into both subsidiary programs run on the build system and into the final program. This approach may be of interest for advanced build system hackers. Note that the build system compiler is rather confusingly called `HOST_CC'.



This document was generated by system on December, 2 2004 using texi2html