unset exit
unset cc
unset cg

Newer 5/cc cc.rez
if {status} != 0
   set exit on
   echo compile -e cc.rez keep=5/cc
   compile -e cc.rez keep=5/cc
   unset exit
end

if {#} == 0
  Newer obj/asm.a asm.pas
  if {status} != 0
     set asm asm
     set cc cc
     set parser parser
  end

  Newer obj/cc.a cc.pas
  if {status} != 0
     set cc cc
  end

  Newer obj/ccommon.a ccommon.pas ccommon.asm
  if {Status} != 0
     set ccommon ccommon
     set asm asm
     set cc cc
     set cgc cgc
     set cgi cgi
     set expression expression
     set mm mm
     set parser parser
     set scanner scanner
     set symbol symbol
     set table table
     set objout2 objout2
     set native2 native2
     set dag2 dag2
     set gen gen
     set header2 header2
  end              

  Newer obj/cgc.a cgc.pas cgc.asm
  if {status} != 0
     set cgc cgc
     set objout2 objout2
     set native2 native2
  end

  Newer obj/cgi.a cgi.pas cgi.comments cgi.debug
  if {status} != 0
     set cgi cgi
     set asm asm
     set cc cc
     set cgc cgc
     set expression expression
     set parser parser
     set scanner scanner
     set symbol symbol
     set objout2 objout2
     set native2 native2
     set dag2 dag2
     set header2 header2
  end

  Newer obj/expression.a expression.pas expression.asm
  if {status} != 0
     set expression expression
     set asm asm
     set cc cc
     set parser parser
  end

  Newer obj/mm.a mm.pas mm.asm
  if {status} != 0
     set mm mm
     set asm asm
     set cc cc
     set expression expression
     set parser parser
     set scanner scanner
     set symbol symbol
     set header2 header2
  end

  Newer obj/native2.a native2.pas
  if {status} != 0
     set native2 native2
  end

  Newer obj/objout2.a objout2.pas objout2.asm
  if {status} != 0
     set objout2 objout2
     set native2 native2
  end

  Newer obj/parser.a parser.pas
  if {status} != 0
     set parser parser
     set cc cc
  end

  Newer obj/scanner.a scanner.pas scanner.debug scanner.asm
  if {status} != 0
     set scanner scanner
     set asm asm
     set cc cc
     set expression expression
     set parser parser
     set symbol symbol
     set header2 header2
  end

  Newer obj/symbol.a symbol.pas symbol.print symbol.asm
  if {status} != 0
     set symbol symbol
     set asm asm
     set cc cc
     set expression expression
     set parser parser
     set header2 header2
  end
     
  Newer obj/table.a table.pas table.asm
  if {status} != 0
     set table table
     set asm asm
     set expression expression
     set parser parser
     set scanner scanner
  end

  Newer obj/dag2.a dag2.pas
  if {status} != 0
     set dag2 dag2
  end

  Newer obj/gen.a gen.pas
  if {status} != 0
     set dag2 dag2
     set gen gen
  end

  Newer obj/header2.a header2.pas
  if {status} != 0
     set cc cc
     set parser parser
     set header2 header2
  end

else
  for i
    set {i} {i}
  end
end

set exit on

if "{table}" == table
   if "{ccommon}" == ccommon
      echo compile +t +e ccommon.pas keep=obj/ccommon
      compile +t +e ccommon.pas keep=obj/ccommon
      unset ccommon
   end
   echo compile +t +e table.pas keep=obj/table
   compile +t +e table.pas keep=obj/table
   echo assemble +t +e table.asm keep=obj/table
   assemble +t +e table.asm keep=obj/table
   echo delete obj/table.root
   delete obj/table.root
end

set list ""
set list        "{ccommon} {mm} {cgi} {scanner} {symbol} {header2} {expression}"
set list {list} {cgc} {asm} {parser} {cc} {objout2} {native2} {gen} {dag2}
if "{list}" != ""
   for i in {list}
      purge >.null
      echo compile +t +e {i}.pas keep=obj/{i}
      compile +t +e {i}.pas keep=obj/{i}
   end
end

unset exit
set exit on
compile linkit2
echo filetype 5/cc exe $DB01
filetype 5/cc exe $DB01
echo purge
purge >.null
