home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / Languages / Caml Light 0.61 / Source / src / launch / camlc next >
Encoding:
Text File  |  1994-07-07  |  2.5 KB  |  101 lines  |  [TEXT/MPS ]

  1. Set Oldecho {echo}; Set echo 0
  2. Set stdlib "LIBDIR"
  3. Set linkalso 1
  4. Set includes ""
  5. Set compopt ""
  6. Set linkopt ""
  7. #Set custom ""
  8. Set linkfiles ""
  9. Set ccfiles ""
  10. Set cclib ""
  11. Set linkopt ""
  12. Set linkout Camlc.out
  13. Set TempFile ":camlprim.`date -n`.c"
  14. Set TempFile2 ":camlprim.`date -n`"
  15.  
  16. Set Exit 0
  17.  
  18. Loop
  19.   If "{1}" == ""
  20.     Break
  21.   Else If "{1}" =~ /(≈)®1.ml/
  22.     camlrun "{stdlib}camlcomp" -stdlib "{stdlib}" {includes} {compopt} "{1}"
  23.     If {Status}
  24.       Set echo {Oldecho}
  25.       Exit {Status}
  26.     End
  27.     Set linkfiles "{linkfiles} {®1}.zo"
  28.   Else If "{1}" =~ /≈.mli/
  29.     camlrun "{stdlib}camlcomp" -stdlib "{stdlib}" {includes} {compopt} "{1}"
  30.     If {Status}
  31.       Set echo {Oldecho}
  32.       Exit {Status}
  33.     End
  34.   Else If "{1}" =~ /≈.zo/
  35.     Set linkfiles "{linkfiles} {1}"
  36.   Else If "{1}" == "-c"
  37.     Set linkalso 0
  38.   Else If "{1}" == "-I" || "{1}" == "-include"
  39.     Set includes "{includes} -I {2}"
  40.     Shift
  41.   Else If "{1}" == "-O" || "{1}" == "-open"
  42.     Set compopt "{compopt} -O {2}"
  43.     Shift
  44.   Else If "{1}" == "-i"
  45.     Set compopt "{compopt} {1}"
  46.   Else If "{1}" == "-g" || "{1}" == "-debug"
  47.     Set linkopt "{linkopt} {1}"
  48.   Else If "{1}" == "-o" || "{1}" == "-exec"
  49.     Set linkout "{2}"
  50.     Shift
  51.   Else If "{1}" == "stdlib"
  52.     Set stdlib "{2}"
  53.     Shift
  54.   Else If "{1}" == "-v" || "{1}" == "-version"
  55.     Echo "The Caml Light system, version 0.61"
  56.     Echo "  (standard library from {stdlib})"
  57.     camlrun -V
  58.     camlrun "{stdlib}camlcomp" -version
  59.     camlrun "{stdlib}camllink" -version
  60.   Else If "{1}" == "-files"
  61.     Set linkfiles "{linkfiles} {1} {2}"
  62.     Shift
  63. #  Else If "{1}" == "-custom"
  64. #    Set custom "-custom {TempFile}"
  65.   Else If "{1}" =~ /≈.o/
  66.     Set ccfiles "{ccfiles} {1}"
  67.   Else If "{1}" == "-ccopt"
  68.     Set ccopt "{ccopt} {2}"
  69.     Shift
  70.   Else If "{1}" =~ /-≈/
  71.     Echo "Unknown option ∂"{1}∂", ignored" >Dev:Stderr
  72.   Else
  73.     Echo "I don't know what to do with file ∂"{1}∂", ignored" >Dev:Stderr
  74.   End
  75.   Shift
  76. End
  77.  
  78. If {linkalso} && "{linkfiles}" != ""
  79.   camlrun "{stdlib}camllink" -stdlib "{stdlib}" {includes} {linkopt} #{custom} ∂
  80.           -exec "{linkout}" "{stdlib}stdlib.zo" {linkfiles}
  81.   If {Status}
  82.     Set echo {Oldecho}
  83.     Exit {Status}
  84.   End
  85. #  If "{custom}"
  86. #    (Rename "{linkout}" "{TempFile2}" ∂
  87. #     && C -i "{stdlib}" "{TempFile}" ∂
  88. #     && Link -o "{linkout}" {ccopt} {ccfiles} "{TempFile}" "{stdlib}libcaml.o" ∂
  89. #     && Catenate "{TempFile2}" >> "{linkout}")
  90. #    If {Status}
  91. #      Delete -i "{linkout}" "{TempFile}" "{TempFile2}"
  92. #      Exit 2
  93. #    Else
  94. #      Delete -i "{TempFile}" "{TempFile2}"
  95. #      Exit 0
  96. #    End
  97. #  End
  98.   setfile -c 'MPS ' -t TEXT {linkout}
  99. End
  100. Set echo {Oldecho}
  101.