1 #! /bin/sh
3 set -e
5 ###^^^^^^^^^^^^^^^^^^###
6 ### Global variables ###
7 ###__________________###
11 _compiler=
12 _linker=
14 _cross=false
15 _bootstrap=false
16 _stages=2
18 _cpu=
19 _target=
20 _system=
21 _host_cpu=
22 _host_target=
23 _host_system=
25 ###^^^^^^^^^^^###
26 ### Functions ###
27 ###___________###
29 usage() {
47 exit 2
48 }
50 error() {
52 exit 1
53 }
55 make_stage() {
60 shift 4
61 "$_this/make.sh" -o "$_dir" -c "$_compiler" -l "$_linker" "$@" "$_this_cpu" "$_this_target" "$_this_system"
64 _linker=
65 else
69 else
71 fi
72 fi
73 }
75 make_verify_stage() {
77 shift
80 else
82 fi
83 }
85 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
86 ### Parse arguments and options ###
87 ###_____________________________###
89 while getopts c:l:u:t:s:g:beh _name
90 do
98 b) _bootstrap=true ;;
99 e) _cross=true ;;
100 h|?) usage ;;
101 esac
102 done
105 usage
106 fi
109 usage
110 fi
119 fi
123 fi
127 fi
129 ###^^^^^^^^^^^^^^^^^^^^###
130 ### Bootstrap compiler ###
131 ###____________________###
135 _compiler=
136 _linker=
138 make_stage "$_this/bootstrap/$_host_cpu-cpfront-$_host_system" "$_host_cpu" "cpfront" "$_host_system" -b
139 else
141 fi
142 else
144 make_verify_stage 0
145 fi
147 ###^^^^^^^^^^^^^^^^^^###
148 ### Recompile itself ###
149 ###__________________###
152 do
155 done
156 _N=
158 ###^^^^^^^^^^^^^^^###
159 ### Cross compile ###
160 ###_______________###
165 fi