How to generate a compiler on on a Sparc that generates sun3 code. 

1.  Do gcc.  run config.gcc the source configuration
	Sparc% config.gcc sun4-os4
	Linked `config.h' to `./config/xm-sparc.h'.
	Linked `tm.h' to `./config/tm-sparc.h'.
	Linked `md' to `./config/sparc.md'.
	Linked `aux-output.c' to `./config/out-sparc.c'.
	Links are now set up for use with a sun4-os4.

    Then run it for the target configuration

	Sparc% config.gcc sun3-nfp-os4
	Linked `config.h' to `./config/xm-m68k.h'.
	Linked `tm.h' to `./config/tm-sun3-nfp.h'.
	Linked `md' to `./config/m68k.md'.
	Linked `aux-output.c' to `./config/out-m68k.c'.
	Links are now set up for use with a sun3-nfp-os4.

    Finally, correct the source piece
    
	rm config.h
	ln -s ./config/xm-sparc.h config.h

    make cpp gcc cc1
    
    Collect these three programs in some directory (actually, I don't think
    you need gcc, it will be the same as the native gcc).
    
2.  Do gas

    make a68.
    
    collect a68 and call it "as".

3.  Do ld (from the binutils directory)

    Edit the Makefile to define a line like
    
    CC = gcc -v -g -nostdinc -Usparc -U__sparc__ -Dmc68000 -Dmc68020 \
	-D__mc68000__ -DCROSS_LINKER -I/r/zep/usr/include

    And, because gcc doesn't like sun's new -target option, also give a
    default rule like:
    
    .c.o:;	$(CC) $(CFLAGS) -c $*.c
    
    make ld
    
    collect ld in the directory.

4.  Write a driver script (or alias).

    #!/bin/sh
    exec /usr/xkernel/bin/gxxx/gcc -B/usr/xkernel/bin/gxxx/ $*

    Naturally, replace the directory name with your own.

5.  Worry about:

	Libraries.  You'll need to make sure that you get libraries (in
	    particular, the c library and gcc library) from the right kind of
	    machine.  ld's "-L/r/WHEREEVER/lib" option is probably the
	    secret for most libraries; copying the gnulib to your directory
	    should take care of it.  (The x-kernel uses ld directly, so
	    didn't solve this problem in a general way).
	Include files.
	    You may want to enhance the script with extra arguments like
	    
		-nostdinc -I/r/WHEREEVER/usr/include

	    so that include files are found from the target system

6.  Voila!

7.  You might also want g++.

    Build cc1plus is the same basic way as cc1.
    
    g++ needs its own linker, which is made from the ld.c sources in "g++".
    It uses a different CPP variable to notice that it is a cross linker,
    the g++ name is _CROSS_TARGET_ARCH (refer to step 3).
    
    You need to add some stuff to the driver to push it into the right
    libraries, and actually need to rebuild gcc so that it will pass an
    extra argument "-nostdlib" to ld.  This is done by modifying the target
    machine file pointed to by the link "tm.h" and adding -nostdlib to the
    LINK_SPEC.  (I made a file called tm-sun3-cross.h with this change), and
    then built g++ with the make flag prefix=/r/bas/usr so it looks by
    default in bas's file systems. (Note: "bas" is the a sun3 file server
    that we do xkernel development on.)
