home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / SASC6571.LZX / extras / lmktosmake < prev    next >
Encoding:
AmigaDOS Script File  |  1996-12-24  |  4.3 KB  |  133 lines

  1. .key source,target
  2. .bra {
  3. .ket }
  4. .def source lmkfile
  5. .def target smakefile
  6.  
  7. ; LMKTOSMAKE Version 6.50
  8. ; By Steve Evans and Doug Walker
  9. ;
  10. ; Attempts to convert makefiles intended for Lattice C and 
  11. ; SAS/C Version 5 to the format required by SAS/C Version 6
  12. ;
  13. ; USAGE: LMKTOSMAKE <source> <target>
  14. ;
  15. ; If not specified, "lmkfile" is used for the source and "smakefile"
  16. ; for the target.
  17.  
  18. if not exists {source}
  19.    echo "USAGE: lmktosmake <source> <target>"
  20.    quit 20
  21. endif
  22.  
  23. echo "LMKTOSMAKE Makefile Converter Version 1.0"
  24.  
  25. if exists {target}
  26.    echo " "
  27.    ask "{target} about to be overwritten, proceed? (Y/N):"
  28.    if not warn 
  29.       quit 20
  30.    endif
  31. endif      
  32.  
  33. echo " "
  34. echo "Converting *"{source}*" to *"{target}*"."
  35.  
  36. echo >{target}  "# Makefile converted using LMKTOSMAKE version 1.0"
  37. echo >>{target} " "
  38. echo >>{target} "CC = sc5"  ;needed because some makefiles omit this
  39. echo >>{target} " "
  40. type >>{target} {source}
  41.  
  42. ; First off, let's get any constructs that we know we can't recognize
  43. ; Invoking the seperate phases of the compiler individually is a problem
  44. ; because the individual phases are now libraries and not invokable as
  45. ; seperate programs.
  46.  
  47. echo " "
  48. echo "LMKTOSMAKE cannot translate any V5 file that invokes the phases of"
  49. echo "the compiler seperately (lc1, lc1b, lc2, and go).  I am now checking"
  50. echo "for such invocations.  If you see any such lines in the following"
  51. echo "output, you must fix them by hand."
  52. echo " "
  53. grep -$ "lc1 "   {target}
  54. grep -$ "lc1b "  {target}
  55. grep -$ "lc2 "   {target}
  56. grep -$ "go "    {target}
  57. echo " "
  58. echo "Done checking."
  59.  
  60. ; Substitute for the LC: path assign.  LC: pointed to the subdirectory of the
  61. ; V5 tree that contained the commands; the equivalent directory in V6 is not
  62. ; SC:, but rather SC:C/ .
  63. ;
  64. ; The funny [] syntax allows mixed-case to be matched.
  65. ;
  66. echo " "
  67. echo "Substituting for lc: and command names..."
  68.  
  69. splat -o "[Ll][Cc]:"   "sc:c/"       {target}
  70.  
  71. ; Substitute for the actual compiler and linker commands.  We use the SC5 command 
  72. ; since it is command-line compatible with Version 5, and translating options would
  73. ; be very, very difficult.  Slink is command-line compatible with Blink.
  74.  
  75. ; "LC " => "sc5 "
  76. splat -o "[Ll][Cc][ \t]"              "sc5 "    {target}
  77.  
  78. ; "LC\n" => "sc5\n"
  79. splat -o "[Ll][Cc][\n]"               "sc5\n"   {target}
  80.  
  81. ; "BLINK " => "slink "
  82. splat -o "[Bb][Ll][Ii][Nn][Kk][ \t]"  "slink "  {target}
  83.  
  84. ; "BLINK\n" => "slink\n"
  85. splat -o "[Bb][Ll][Ii][Nn][Kk][\n]"   "slink\n" {target}
  86.  
  87. ; "LMK " => "smake "
  88. splat -o "[Ll][Mm][Kk][ \t]"          "smake "  {target}
  89.  
  90. ; "LMK\n" => "smake\n"
  91. splat -o "[Ll][Mm][Kk][\n]"           "smake\n" {target}
  92.  
  93. ;
  94. ; Substitute for the link libraries.  Note that in V6, the registerized
  95. ; and nonregisterized libraries have been combined into one.  This means,
  96. ; for example, that "lc.lib" and "lcr.lib" should both get translated
  97. ; to "sc.lib".
  98. ;
  99. ; Note that the double asterisk is necessary to get a single asterisk into
  100. ; the strings; AmigaDOS treats the first one as an escape character.
  101. ;
  102. echo " "
  103. echo "Substituting for link libraries and DEFINEs..."
  104. splat -o "[Ss][Mm][Aa][Ll][Ll]\.[Ll][Ii][Bb]"    "amiga.lib"   {target}
  105. splat -o "[Ll][Cc][Rr]**\.[Ll][Ii][Bb]"          "sc.lib"      {target}
  106. splat -o "[Ll][Cc][Mm][Rr]**\.[Ll][Ii][Bb]"      "scm.lib"     {target}
  107. splat -o "[Ll][Cc][Mm][Ii][Ee][Ee][Ee]\.[Ll][Ii][Bb]" "scmieee.lib" {target}
  108. splat -o "[Ll][Cc][Mm][Ff][Ff][Pp]\.[Ll][Ii][Bb]"  "scmffp.lib"  {target}
  109. splat -o "[Ll][Cc][Mm][Ss][Rr]**\.[Ll][Ii][Bb]"  "scms.lib"    {target}
  110. splat -o "[Ll][Cc][Mm][Rr]**881\.[Ll][Ii][Bb]"   "scm881.lib"  {target}
  111. splat -o "[Ll][Cc][Nn][Bb]\.[Ll][Ii][Bb]"        "scnb.lib"    {target}
  112. splat -o "[Ll][Cc][Ss][Rr]**\.[Ll][Ii][Bb]"      "scs.lib"     {target}
  113. splat -o "[Ll][Cc][Ss][Nn][Bb]\.[Ll][Ii][Bb]"    "scsnb.lib"   {target}
  114.  
  115. ; Version 5.x users often added a DEFINE statement to the link
  116. ; line to get rid of part of the normal startup.  This statement
  117. ; took the form 
  118. ;
  119. ;    DEFINE __main=__tinymain
  120. ;
  121. ; or a variant.  The correct change in 6.0 is
  122. ;
  123. ;    DEFINE ___main=___tinymain
  124. ;
  125. ; Actually, in 6.50 we could do away with it altogether, but this
  126. ; will work OK without unresolved symbols.
  127. ;
  128. splat -o "[_@]_main"      "___main"     {target}
  129. splat -o "[_@]_tinymain"  "___tinymain" {target}
  130.  
  131. echo " "
  132. echo "LMKTOSMAKE finished.  Output filename is *"{target}*"."
  133.