2000-10-31 Philip Blundell <philb@gnu.org>
[external/binutils.git] / mpw-build.in
index a581e62..86d9530 100644 (file)
@@ -4,127 +4,201 @@ Set savedir "`Directory`"
 
 #Set Echo 1
 
-Set thisscript "{0}"
-
-Set topsrcdir ":"
-
-Set srcdir ":"
+Set ThisScript "{0}"
 
 Set objdir ":"
 
 Set verify 0
-Set verifystr ""
 
 Set BuildTarget "none"
 
-Set prefix "{Boot}"Cygnus:latest:
-
 # Parse arguments.
 
 Loop
        Break If {#} == 0
-       If "{1}" =~ /--srcdir/
-               Set srcdir "{2}"
-               Shift 1
-       Else If "{1}" =~ /--topdir/
-               Set topsrcdir "{2}"
-               Shift 1
-       Else If "{1}" =~ /--prefix/
-               Set prefix "{2}"
-               Shift 1
-       Else If "{1}" =~ /-v/
-               Set verify 1
-               Set verifystr "-v"
-               Shift 1
-       Else
                If "{BuildTarget}" =~ /none/
                        Set BuildTarget "{1}"
                Else
                        Echo Only one build target allowed, ignoring "{1}"
                End If
-       End If
        Shift 1
 End Loop
 
+If "{BuildTarget}" =~ /none/
+       Set BuildTarget "all"
+End If
+
+If {verify} == 1
+       Echo "#" Doing "{ThisScript}" "{BuildTarget}" in "`Directory`" ... 
+End If
+
+Set ranmake 0
+
+If "`Exists Makefile`" != ""
+       Echo "Set Echo 1" >{BuildTarget}.makeout
+       Make -f Makefile {BuildTarget} >>{BuildTarget}.makeout
+       {BuildTarget}.makeout
+       Delete {BuildTarget}.makeout
+       Set ranmake 1
+End If
+
+If "`Exists Makefile.PPC`" != ""
+       Echo "Set Echo 1" >{BuildTarget}.makeout.ppc
+       Make -f Makefile.PPC {BuildTarget} >>{BuildTarget}.makeout.ppc
+       {BuildTarget}.makeout.ppc
+       Delete {BuildTarget}.makeout.ppc
+       Set ranmake 1
+End If
+
+If {ranmake} == 1
+       Exit
+End If
+
+# Dispatch on various pseudo-targets.
+
 If "{BuildTarget}" =~ /all/
-       "{thisscript}" all-ld
-       "{thisscript}" all-gcc
-       "{thisscript}" all-gdb
+       Echo Started `Date`
+       "{ThisScript}" all-gcc
+       "{ThisScript}" all-gdb
+       Echo Finished `Date`
+Else If "{BuildTarget}" =~ /all-libiberty/
+       "{ThisScript}" do-libiberty
+Else If "{BuildTarget}" =~ /all-bfd/
+       "{ThisScript}" do-bfd
+Else If "{BuildTarget}" =~ /all-opcodes/
+       "{ThisScript}" do-opcodes
+Else If "{BuildTarget}" =~ /all-byacc/
+       "{ThisScript}" do-byacc
+Else If "{BuildTarget}" =~ /all-flex/
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" do-flex
 Else If "{BuildTarget}" =~ /all-binutils/
-       "{thisscript}" do-libiberty
-       "{thisscript}" do-bfd
-       "{thisscript}" do-opcodes
-       "{thisscript}" do-binutils
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-bfd
+       "{ThisScript}" all-opcodes
+       "{ThisScript}" do-binutils
 Else If "{BuildTarget}" =~ /all-gas/
-       "{thisscript}" do-libiberty
-       "{thisscript}" do-bfd
-       "{thisscript}" do-opcodes
-       "{thisscript}" do-gas
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-bfd
+       "{ThisScript}" all-opcodes
+       "{ThisScript}" do-gas
 Else If "{BuildTarget}" =~ /all-gcc/
-       "{thisscript}" all-gas
-       "{thisscript}" do-gcc
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-gas
+       "{ThisScript}" all-binutils
+       "{ThisScript}" all-ld
+       "{ThisScript}" do-gcc
 Else If "{BuildTarget}" =~ /all-gdb/
-       "{thisscript}" do-libiberty
-       "{thisscript}" do-bfd
-       "{thisscript}" do-opcodes
-       "{thisscript}" do-gdb
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-bfd
+       "{ThisScript}" all-opcodes
+       "{ThisScript}" do-gdb
+Else If "{BuildTarget}" =~ /all-grez/
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-bfd
+       "{ThisScript}" do-grez
 Else If "{BuildTarget}" =~ /all-ld/
-       "{thisscript}" do-libiberty
-       "{thisscript}" do-bfd
-       "{thisscript}" do-opcodes
-       "{thisscript}" do-ld
+       "{ThisScript}" all-libiberty
+       "{ThisScript}" all-bfd
+       "{ThisScript}" all-opcodes
+       "{ThisScript}" do-ld
+Else If "{BuildTarget}" =~ /do-byacc/
+       SetDirectory :byacc:
+       ::mpw-build all
+Else If "{BuildTarget}" =~ /do-flex/
+       SetDirectory :flex:
+       ::mpw-build _bootstrap
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-bfd/
        SetDirectory :bfd:
-       BuildProgram all
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-libiberty/
        SetDirectory :libiberty:
-       BuildProgram all
-Else If "{BuildTarget}" =~ /do-mmalloc/
-       SetDirectory :mmalloc:
-       BuildProgram all
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-opcodes/
        SetDirectory :opcodes:
-       BuildProgram all
-Else If "{BuildTarget}" =~ /do-readline/
-       SetDirectory :readline:
-       BuildProgram all
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-binutils/
        SetDirectory :binutils:
-       BuildProgram all
+       ::mpw-build stamps
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-gas/
        SetDirectory :gas:
-       :mpw-build all --prefix "{prefix}"
+       ::mpw-build stamps
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-gcc/
        SetDirectory :gcc:
-       :mpw-build all --prefix "{prefix}"
+       :mpw-build all
 Else If "{BuildTarget}" =~ /do-gdb/
        SetDirectory :gdb:
-       BuildProgram all
+       ::mpw-build all
+Else If "{BuildTarget}" =~ /do-grez/
+       SetDirectory :grez:
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /do-ld/
        SetDirectory :ld:
-       BuildProgram all
+       ::mpw-build all
+Else If "{BuildTarget}" =~ /do-newlib/
+       SetDirectory :newlib:
+       ::mpw-build all
 Else If "{BuildTarget}" =~ /install/
-       "{thisscript}" install-binutils
-       "{thisscript}" install-gas
-       "{thisscript}" install-gcc
-       "{thisscript}" install-gdb
-       "{thisscript}" install-ld
+       "{ThisScript}" install-only-top
+       "{ThisScript}" install-binutils
+       "{ThisScript}" install-gas
+       "{ThisScript}" install-gcc
+       "{ThisScript}" install-ld
+       "{ThisScript}" install-gdb
 Else If "{BuildTarget}" =~ /install-binutils/
        SetDirectory :binutils:
-       :mpw-build install --prefix "{prefix}"
+       ::mpw-build install
 Else If "{BuildTarget}" =~ /install-gas/
        SetDirectory :gas:
-       :mpw-build install --prefix "{prefix}"
+       ::mpw-build install
 Else If "{BuildTarget}" =~ /install-gcc/
        SetDirectory :gcc:
-       :mpw-build install --prefix "{prefix}"
+       :mpw-build install
 Else If "{BuildTarget}" =~ /install-gdb/
        SetDirectory :gdb:
-       :mpw-build install --prefix "{prefix}"
+       ::mpw-build install
+Else If "{BuildTarget}" =~ /install-grez/
+       SetDirectory :grez:
+       ::mpw-build install
 Else If "{BuildTarget}" =~ /install-ld/
        SetDirectory :ld:
-       :mpw-build install --prefix "{prefix}"
+       ::mpw-build install
+Else If "{BuildTarget}" =~ /install-only/
+       "{ThisScript}" install-only-top
+       "{ThisScript}" install-only-binutils
+       "{ThisScript}" install-only-gas
+       "{ThisScript}" install-only-gcc
+       "{ThisScript}" install-only-gdb
+       "{ThisScript}" install-only-ld
+Else If "{BuildTarget}" =~ /install-only-binutils/
+       SetDirectory :binutils:
+       ::mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-gas/
+       SetDirectory :gas:
+       ::mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-gcc/
+       SetDirectory :gcc:
+       :mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-gdb/
+       SetDirectory :gdb:
+       ::mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-grez/
+       SetDirectory :grez:
+       ::mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-ld/
+       SetDirectory :ld:
+       ::mpw-build install-only
+Else If "{BuildTarget}" =~ /install-only-top/
+       NewFolderRecursive "{prefix}"
+       If "{prefix}" != "`Directory`"
+               Duplicate -y 'Read Me for MPW' "{prefix}"'Read Me for MPW'
+               Duplicate -y Install "{prefix}"Install
+       End If
 Else
+       Echo {BuildTarget} not understood, ignoring
 End If
 
 SetDirectory "{savedir}"