#! /bin/csh
#
#  Build gccos9 cross compiler for OS-9/68000 - JDB, February 1991

#  If file names are set up for OS-9/68000 native compiler (with "_"),
#  remove all intermediate native compiler files and restore source
#  file names to UNIX form (with "-").
if (-e Makefile_osk_native) then
  make -f Makefile_osk_native cleanconfig
  rm -f tm_m68k.h
  osk2unix *_* config/*_*
endif
#  Remove all intermediate cross compiler files.
make -f Makefile-osk-cross 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-vax.h config.h
#  Make cross compiler versions of gcc, cccp and cc1
make -f Makefile-osk-cross gcc cpp cc1

#  Installation of gccos9 cross compiler:
#
#  cp gcc /usr/local/bin/gccos9
#  cp cpp /usr/local/lib/gccos9-cpp
#  cp cc1 /usr/local/lib/gccos9-cc1
#  chmod 555 /usr/local/bin/gccos9 /usr/local/lib/gccos9-cpp \
#     /usr/local/lib/gccos9-cc1

#  Installation of components of Microware's Unibridge for gccos9:
#
#  Gccos9 can call o68, r68, r68020 and ld68, which are all components
#  of Unibridge, as are run time libraries other than gnulib.l, and
#  standard header files other than those listed below.
#
#  Unibridge, which is a licensed product of Microware, is installed
#  at CERN in the following directories:
#     /usr/local/os9/bin_2.3
#     /usr/local/os9/lib_2.3
#     /usr/local/os9/def_2.3
#     /usr/local/os9/bin
#     /usr/local/os9/lib
#     /usr/local/os9/def
#  Directories whose names end in "_2.3" are preferred, as they contain
#  the more up to date version of Unibridge.

#  Installation of standard header files for gccos9:
#
#  cp assert.h /usr/local/lib/gccos9-include/assert.h
#  cp limits.h /usr/local/lib/gccos9-include/limits.h
#  cp osksrc/math.h /usr/local/lib/gccos9-include/math.h
#  cp osksrc/math881.h /usr/local/lib/gccos9-include/math881.h
#  cp stdarg.h /usr/local/lib/gccos9-include/stdarg.h
#  cp stddef.h /usr/local/lib/gccos9-include/stddef.h
#  cp osksrc/varargs.h /usr/local/lib/gccos9-include/varargs.h
#  chmod 444 assert.h limits.h math.h math881.h stdarg.h stddef.h varargs.h

#  Installation of gnulib.l for gccos9:
#
#  Use Build-osk-native to create gnulib.l.
#
#  cp gnulib.l /usr/local/lib/gccos9-lib/gnulib.l
#  chmod 444 /usr/local/lib/gccos9-lib/gnulib.l
