home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 91 / af091a.adf / af91a2.lzx / bin / bas.phx < prev    next >
AmigaDOS Script File  |  2018-01-22  |  2KB  |  94 lines

  1. .key arg1,arg2,arg3
  2.  
  3. ; ** Preprocess, compile, assemble and link an ACE program **
  4. ; ** using PhxAss and PhxLnk for the last two stages. **
  5.  
  6. ; make sure stack is big enough.
  7. STACK 40000
  8.  
  9. ; don't abort script if ACE or APP quits
  10. ; with a return code of 10 (ERROR).
  11. FAILAT 11
  12.  
  13. IF <arg2> GT ""
  14.  
  15.  ; at least 2 arguments: <arg1> = compiler options.
  16.  ;        <arg2> = ACE source file.
  17.  ;        <arg3> = extra object module/library to link.
  18.  
  19.  IF EXISTS <arg2>.bas
  20.    ;try ".bas" extension
  21.    set source <arg2>.bas
  22.  ELSE
  23.    ;assume ".b" extension
  24.    set source <arg2>.b  
  25.  ENDIF
  26.  
  27.  ; preprocess source file.
  28.  app $source ram:t/$source
  29.  IF NOT ERROR
  30.  
  31.    ; compile preprocessed source file.
  32.    ace <arg1> ram:t/$source
  33.  
  34.    IF NOT ERROR
  35.      ; assemble and link
  36.      delete >NIL: ram:t/$source
  37.      PhxAss ram:t/<arg2>.s
  38.      delete >NIL: ram:t/<arg2>.s
  39.      PhxLnk ram:t/<arg2>.o <arg3> ACElib:startup.lib ACElib:db.lib ACElib:ami.lib SMALLCODE SMALLDATA
  40.  
  41.      ; leave us with the executable (and icon?).
  42.      copy ram:t/<arg2> ""
  43.  
  44.      IF EXISTS ram:t/<arg2>.info
  45.        copy ram:t/<arg2>.info ""
  46.      ENDIF
  47.  
  48.      ; kill any remaining temporary files.
  49.      delete >NIL: ram:t/<arg2>#?
  50.    ENDIF
  51.  
  52.  ENDIF
  53.  
  54. ELSE
  55.  
  56.  ; no compiler options: <arg1> = ACE source file.
  57.  ;       <arg2> = extra object module/library to link.
  58.  
  59.  IF EXISTS <arg1>.bas
  60.    ;try ".bas" extension
  61.    set source <arg1>.bas
  62.  ELSE
  63.    ;assume ".b" extension
  64.    set source <arg1>.b  
  65.  ENDIF
  66.  
  67.  app $source ram:t/$source
  68.  
  69.  IF NOT ERROR
  70.  
  71.    ; compile source file.
  72.    ace ram:t/$source
  73.  
  74.    IF NOT ERROR
  75.      ; assemble and link.
  76.      delete >NIL: ram:t/$source
  77.      PhxAss ram:t/<arg1>.s
  78.      delete >NIL: ram:t/<arg1>.s
  79.      PhxLnk ram:t/<arg1>.o <arg2> ACElib:startup.lib ACElib:db.lib ACElib:ami.lib SMALLCODE SMALLDATA
  80.  
  81.      ; leave us with the executable (and icon?).
  82.      copy ram:t/<arg1> ""
  83.  
  84.      IF EXISTS ram:t/<arg1>.info
  85.        copy ram:t/<arg1>.info ""
  86.      ENDIF
  87.  
  88.      ; kill any remaining temporary files.
  89.      delete >NIL: ram:t/<arg1>#?
  90.    ENDIF
  91.  ENDIF
  92.  
  93. ENDIF
  94.