Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/system/cmb-cross
ViewVC logotype

Diff of /sml/trunk/system/cmb-cross

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5556, Sat Jul 13 22:01:55 2019 UTC revision 5557, Sat Jul 13 23:09:48 2019 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2  #  #
3  # cross compile to specified target  # COPYRIGHT (c) 2019 The Fellowship of SML/NJ (http://www.smlnj.org)
4    # All rights reserved.
5    #
6    # usage: cmb-cross <target>
7    #       <target>        -- one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32
8    #
9    # cross compile to the specified target
10  #  #
11    
12    this=$0
13    here=`pwd`
14    cd ../..
15    twoup=`pwd`
16    cd $here
17    
18  function usage {  function usage {
19    echo "usage: cmb-cross <target>"    echo "usage: cmb-cross <target>"
20    echo "where <target> is one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32"    echo "where <target> is one of amd64-unix, ppc-unix, sparc-unix, x86-unix, or x86-win32"
# Line 13  Line 25 
25    usage    usage
26  fi  fi
27    
28    # check linking command
29    LINK=$twoup/bin/.link-sml
30    if [ ! -x $LINK ] ; then
31        echo $this: link script $LINK is not operational.
32        exit 1
33    fi
34    
35    # get host ARCH and OPSYS variables
36    if [ -f $twoup/bin/.arch-n-opsys ]; then
37        ARCH_N_OPSYS=`$twoup/bin/.arch-n-opsys`
38        if [ "$?" = "0" ]; then
39            eval $ARCH_N_OPSYS
40        fi
41    else
42        echo "$this: .arch-n-opsys is missing"
43        exit 1
44    fi
45    
46    HOST_ARCH=$(echo $ARCH | tr "[:lower:]" "[:upper:]")
47    HOST_OPSYS=$(echo $OPSYS | tr "[:lower:]" "[:upper:]")
48    
49    # determine the target ARCH, OPSYS, SIZE, and ENDIANESS variables
50  target=$1  target=$1
51  case $target in  case $target in
52    amd64-unix) CMB=AMD64UnixCMB ;;    amd64-unix)
53    ppc-unix) CMB=PPCUnixCMB ;;      architecture=amd64
54    sparc-unix) CMB=SparcUnixCMB ;;      TARGET_ARCH=AMD64;
55    x86-unix) CMB=X86UnixCMB ;;      TARGET_OPSYS=UNIX
56    x86-win32) CMB=X86Win32CMB ;;      TARGET_SIZE=64
57        TARGET_ENDIANESS=LITTLE
58        ;;
59      ppc-unix)
60        architecture=ppc
61        TARGET_ARCH=PPC;
62        TARGET_OPSYS=UNIX
63        TARGET_SIZE=32
64        TARGET_ENDIANESS=BIG
65        ;;
66      sparc-unix)
67        architecture=sparc
68        TARGET_ARCH=SPARC;
69        TARGET_OPSYS=UNIX
70        TARGET_SIZE=32
71        TARGET_ENDIANESS=BIG
72        ;;
73      x86-unix)
74        architecture=x86
75        TARGET_ARCH=X86;
76        TARGET_OPSYS=UNIX
77        TARGET_SIZE=32
78        TARGET_ENDIANESS=LITTLE
79        ;;
80      x86-win32)
81        architecture=x86
82        TARGET_ARCH=X86;
83        TARGET_OPSYS=WIN32
84        TARGET_SIZE=32
85        TARGET_ENDIANESS=LITTLE
86        ;;
87    *) echo "cmb-cross: unrecognized target '$target'"    *) echo "cmb-cross: unrecognized target '$target'"
88       exit 1       exit 1
89    ;;    ;;
90  esac  esac
91    
92    # lower-case architecture name
93    architecture=$(echo $TARGET_ARCH | tr "[:upper:]" "[:lower:]")
94    
95  unset VERSIONTOOL_BUMP_RELEASE  unset VERSIONTOOL_BUMP_RELEASE
96    
97  echo "$CMB.make();" | ../../bin/sml \$smlnj/compiler/all.cm  echo "$this: build $target-cross bin/boot files"
98    ../../bin/sml -DNO_PLUGINS \$smlnj/cmb.cm << XXXX
99    #set (CMB.symval "ARCH_${HOST_ARCH}") NONE;
100    #set (CMB.symval "OPSYS_${HOST_OPSYS}") NONE;
101    #set (CMB.symval "ARCH_${TARGET_ARCH}") (SOME 1);
102    #set (CMB.symval "OPSYS_${TARGET_OPSYS}") (SOME 1);
103    #set (CMB.symval "TARGET_SIZE_${TARGET_SIZE}") (SOME 1);
104    #set (CMB.symval "TARGET_${TARGET_ENDIANESS}_ENDIAN") (SOME 1);
105    CMB.make' (SOME "$target-cross");
106    XXXX
107    
108    # the following is equivalent to running
109    #
110    #       ./makeml -boot $target-cross.boot.x86-unix -rebuild $architecture
111    #
112    echo "$this: cross compile to $target"
113    
114    if [ $OPSYS = win32 ] ; then
115        BOOT_DIR="${target}-cross.boot.${ARCH}-win32"
116    else
117        BOOT_DIR="${target}-cross.boot.${ARCH}-unix"
118    fi
119    
120    MODE="@SMLrebuild=${architecture}"
121    
122    CM_PATHCONFIG=${CM_PATHCONFIG:-$twoup/lib/pathconfig}
123    export CM_PATHCONFIG
124    
125    cd $BOOT_DIR
126    
127    echo $this: $LINK $RUN @SMLboot=BOOTLIST @SMLheap=sml $MODE
128    if $LINK $RUN @SMLboot=BOOTLIST @SMLheap=sml $MODE ; then
129        echo $this: New binfiles are ready.
130        exit 0
131    else
132        echo $this: Something broke.
133        exit 1
134    fi

Legend:
Removed from v.5556  
changed lines
  Added in v.5557

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0