home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / GCC-2.3.3r12.sit.hqx / GCC-2.3.3r12 / InstallGCC < prev    next >
Text File  |  1993-04-26  |  5KB  |  183 lines

  1. #
  2. #    "InstallGCC" <options>
  3. #
  4. #    Location:
  5. #        top level of GCC directory, do not move!
  6. #
  7. #    Created July 1992
  8. #        by: Brent Pease (person to complain to and send bug reports)
  9. #            Stan Shebs
  10. #
  11. #    Purpose:
  12. #        To install the GCC compiler for a specific back end and stage
  13. #        by coping the appropriate files into the selected tools and scripts
  14. #        directory.
  15. #
  16. #    Options:
  17. #        Do "InstallGCC -help" to see all the options.
  18. #
  19.  
  20. Set SaveDir `Directory`
  21.  
  22. Set DefaultTargetMachine "Mac68K"
  23.  
  24. Set MustBuild 0
  25. Set MustInstall 1
  26. Set NumStages 1
  27. Set OrigScriptPlace "Scripts:"
  28. Set OrigToolPlace "Tools:"
  29. Set AskForScriptPlace 1
  30. Set AskForToolPlace 1
  31. Set TargetMachineList ""
  32. Set ToolList ""
  33. Set TargetMachineToolList ""
  34. Set ConfirmDup ""
  35. Set Testing ""
  36. Set CheckArg ""
  37.  
  38. Loop
  39.     Break If "{#}" == 0
  40.     If "{1}" =~ /-build/
  41.         Set MustBuild 1
  42.     Else if "{1}" =~ /-check/
  43.         Set Testing "Echo '    '"
  44.         Set CheckArg "{1}"
  45.     Else if "{1}" =~ /-help/
  46.         echo    "InstallGCC [ options | machines ] ...        # Install/Build GNU C Compiler"
  47.         echo    "    -build                Force a build"
  48.         echo    "    -check                Display commands without executing them"
  49.         echo    "    -help                Display this message"
  50.         echo    "    -noinstall            Don't install anything"
  51.         echo    "    -only <tools>        Do only the tools in <tools>"
  52.         echo    "    -scripts <dir>        Install scripts from <dir>"
  53.         echo    "    -target <machine>    Install/Build for the given target machine"
  54.         echo    "    -tools <dir>        Install tools from <dir>"
  55.         echo    "    -y                    Automatically confirm overwrites"
  56.         echo    "    -[1234]                Do 1, 2, 3, or 4 self-build stages"
  57.         echo    ""
  58.         echo    "Target machines currently available:"
  59.         echo    ""
  60.         for TargetFolder in `Files :Targets:`
  61.             If "{TargetFolder}" =~ /:(≈)®1:/
  62.                 echo    "    " "{®1}"
  63.             End If
  64.         End For
  65.         Echo    ""
  66.         Exit 0
  67.     Else if "{1}" =~ /-n/
  68.     Else if "{1}" =~ /-noinstall/
  69.         Set MustInstall 0
  70.     Else if "{1}" =~ /-scripts/
  71.         Shift 1
  72.         Set NewScriptPlace "{1}"
  73.         Set AskForScriptPlace 0
  74.     Else if "{1}" =~ /-target/
  75.         Shift 1
  76.         Set TargetMachine "{1}"
  77.     Else if "{1}" =~ /-tools/
  78.         Shift 1
  79.         Set NewToolPlace "{1}"
  80.         Set AskForToolPlace 0
  81.     Else if "{1}" =~ /-y/
  82.         Set ConfirmDup "{1}"
  83.     Else if "{1}" =~ /-([1234])®1/
  84.         Set NumStages "{®1}"
  85.     Else If "`Exists -d :Targets:{1}`" != ""
  86.         # Add the argument to the list of target machines.
  87.         Set TargetMachineList "{TargetMachineList} {1}"
  88.     Else
  89.         # Don't allow any garbage options.
  90.         echo Option ∂""{1}"∂" not understood, exiting
  91.         Exit 1
  92.     End
  93.     Shift 1
  94. End Loop
  95.  
  96. If "{TargetMachineList}" == ""
  97.     Set TargetMachineList "{DefaultTargetMachine}"
  98. End If
  99.  
  100. If "{ToolList}" == ""
  101.     Set ToolList "gcc_driver"
  102. End If
  103.  
  104. If "{TargetMachineToolList}" == ""
  105.     Set TargetMachineToolList "cpp cc1 cc1plus"
  106. End If
  107.  
  108. # Repeat the installation procedure for all the requested targets.
  109.  
  110. For TargetMachine in {TargetMachineList}
  111.     For ToolName in {ToolList}
  112.         If "`Exists :Tools:{ToolName}`" == ""
  113.             Set MustBuild 1
  114.         End If
  115.     End For
  116.     For ToolPrefix in {TargetMachineToolList}
  117.         If "`Exists :Tools:{ToolPrefix}_{TargetMachine}`" == ""
  118.             Set MustBuild 1
  119.         End If
  120.     End For
  121.     # If a build is necessary or demanded explicitly, do it.
  122.     If "{MustBuild}" != 0
  123.         BuildGCC "{TargetMachine}","{NumStages}","all" {CheckArg}
  124.         If {Status} != 0
  125.             Exit 1
  126.         Else
  127.         End If
  128.     End If
  129. End For
  130.  
  131. If {AskForToolPlace} != 0
  132.     Directory "{MPW}Tools:"
  133.     Set NewToolPlace "`GetFileName -wd -m "Select a tool destination"`"
  134.     If {status} != 0
  135.         Directory "{SaveDir}"
  136.         exit 1
  137.     End If
  138. End If
  139.  
  140. If {AskForScriptPlace} != 0
  141.     Directory "{MPW}Scripts:"
  142.     Set NewScriptPlace "`GetFileName -wd -m "Select a script destination"`"
  143.     If {status} != 0
  144.         Directory "{SaveDir}"
  145.         exit 1
  146.     End If
  147. End If
  148.  
  149. If {MustInstall} != 0
  150.     For ScriptName in "gC" "gCPlus"
  151.         set OrigFileName "{SaveDir}{OrigScriptPlace}{ScriptName}"
  152.         {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewScriptPlace}{ScriptName}"
  153.     End For
  154.     For ToolName in "gcc_driver"
  155.         If "`Exists :Tools:{ToolName}`" != ""
  156.             set OrigFileName "{SaveDir}:Tools:{ToolName}"
  157.         Else
  158.             set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
  159.         End If
  160.         {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
  161.     End For
  162.     # Install all the target-specific tools requested.
  163.     For TargetMachine in {TargetMachineList}
  164.         For ToolPrefix in "cpp_" "cc1_" "cc1plus_"
  165.             set ToolName "{ToolPrefix}{TargetMachine}"
  166.             Set OrigToolPlace "Stage{NumStages}-{TargetMachine}:"
  167.             set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
  168.             {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
  169.         End For
  170.         # The branch-shortening tool is only needed for 68K Macs.
  171.         if "{TargetMachine}" == "Mac68K"
  172.             Set ToolName "shorten"
  173.             Set OrigToolPlace "Stage{NumStages}-{TargetMachine}:"
  174.             set OrigFileName "{SaveDir}{OrigToolPlace}{ToolName}"
  175.             {Testing} Duplicate {ConfirmDup} "{OrigFileName}" "{NewToolPlace}{ToolName}"
  176.         End If
  177.     End For
  178. End If
  179.  
  180. Directory "{SaveDir}"
  181.  
  182. exit 0
  183.