Subject: Predefined symbols in gcc
To: None <port-m68k@sun-lamp.cs.berkeley.edu>
From: Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
List: port-m68k
Date: 12/06/1993 14:07:23
We now have the infrastructure to allow all the m68k-based ports to use
a common set of sources.  This is *great*.  However, this also means
that gcc doesn't predefine a symbol for the local machine type (hp300,
sun3, amiga, mac68k, da30) any more.  Also, some ports may wish to
define additional symbols, such as hp9000 for the hp300 port.

It seems to me that this means that gcc2/arch/m68k/tm.h is going to
have to include a small port-dependent file in order to get the
definition of CPP_PREDEFINES right for each port.  One way to do this
would be to have, in arch/m68k/tm.h,

#include PORT_DEP

and in the various Makefiles, add

	-DPORT_DEP=\"<tm-${MACHINE}.h>\"

to CFLAGS.  We would then have file tm-hp300.h, tm-sun3.h, etc., which
would contain the CPP_PREDEFINES definition.  (This would force the
other ports to have tm-xxx.h files also.)

An alternative would be to have hp300/, sun3/, etc. subdirectories of
gcc2/arch/m68k, and in each have a file tm-port.h which contained the
definition of CPP_PREDEFINES.  tm.h would then say just #include <tm-port.h>.
We'd also have to change the Makefiles to add
-I(whatever)/arch/${MACHINE_ARCH}/${MACHINE} to CFLAGS.

Can anyone think of a better way?


------------------------------------------------------------------------------