#! /bin/csh
#
#  Build gcc native compiler for OS-9/68000 - JDB, February 1991
#
#  This command script uses the cross compiler gccos9 to build the
#  first OS-9/68000 native gcc compiler.  It also builds the run time
#  library gnulib.l, using Microware's cross compiler cc68 for gnulib
#  and gccos9 for gnulib2.
#
#  Usage: Build-osk-native GCCED=? CCCPED=? CC1ED=?
#  where the three question marks ("?") should be replaced by the
#  edition numbers to be assigned to the new executable modules
#  gcc, cccp and cc1 respectively.

#  If file names are set up for gccos9 cross compiler (with "-"),
#  remove all intermediate cross compiler files and change source
#  file names to OS-9 form (with "_").
if (-e Makefile-osk-cross) then
  make -f Makefile-osk-cross cleanconfig
  unix2osk *-* config/*-*
endif
#  Remove all intermediate native compiler files.
make -f Makefile_osk_native cleanconfig
#  Configure symbolic links to header files
rm -f tm_m68k.h
ln -s config/m68osk.md md
ln -s config/out_osk.c aux_output.c
ln -s config/tm_osk.h tm.h
ln -s config/tm_m68k.h tm_m68k.h
ln -s config/xm_osk.h config.h
#  Set up environment variables for Microware's cc68 compiler
source init_cc68
#  Make gnulib.l (gnulib and gnulib2)
make -f Makefile_osk_native gnulib.l
#  Make native compiler versions of gcc, cccp and cc1
make -f Makefile_osk_native gcc cpp cc1 $*

#  Installation of gnulib.l and gcc on an OS-9/68000 system:
#
#  In /DD/GCCLIB:       gnulib.l
#  In /DD/CMDS:         gcc, cccp, cc1
#  In /DD/CMDS/STB:     gcc.stb, cccp.stb, cc1.stb
#
#  When bootstrapping gcc into an OS-9/68000 system, the files should
#  be installed in, say, /H0/GCC/STAGE1 and then used to build the next
#  generation of gcc in /H0/GCC/STAGE2.

#  Installation of standard header files on an OS-9/68000 system:
#
#  assert.h             /DD/GCCDEFS/assert.h
#  limits.h             /DD/GCCDEFS/limits.h
#  osksrc/math.h        /DD/GCCDEFS/math.h
#  osksrc/math881.h     /DD/GCCDEFS/math881.h
#  stdarg.h             /DD/GCCDEFS/stdarg.h
#  stddef.h             /DD/GCCDEFS/stddef.h
#  osksrc/varargs.h     /DD/GCCDEFS/varargs.h
#
#  When bootstrapping gcc into an OS-9/68000 system, header files needed
#  to rebuild gcc are taken from, say, /H0/GCC and /H0/GCC/OSKSRC.
