1 #! /bin/bash
3 set -e
5 abspath() {
7 }
9 ###^^^^^^^^^^^^^^^^^^###
10 ### Global variables ###
11 ###__________________###
15 _compiler=
16 _linker=
18 _cross=false
19 _bootstrap=false
20 _stages=2
22 _cpu=
23 _target=
24 _system=
25 _host_cpu=
26 _host_target=
27 _host_system=
32 ###^^^^^^^^^^^###
33 ### Functions ###
34 ###___________###
36 usage() {
63 exit 2
64 }
66 error() {
68 exit 1
69 }
71 make_stage() {
76 shift 4
77 "$_this/make.sh" -o "$_dir" -c "$_compiler" -l "$_linker" "$@" "$_this_cpu" "$_this_target" "$_this_system"
78 local _ext=
83 fi
86 _linker=
87 else
91 else
93 fi
94 fi
95 }
97 make_verify_stage() {
99 shift
102 else
104 fi
105 }
107 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
108 ### Parse arguments and options ###
109 ###_____________________________###
111 while getopts c:l:u:t:s:g:beh _name
112 do
120 b) _bootstrap=true ;;
121 e) _cross=true ;;
122 h|?) usage ;;
123 esac
124 done
127 usage
128 fi
131 usage
132 fi
141 fi
145 fi
149 fi
151 ###^^^^^^^^^^^^^^^^^^^^###
152 ### Bootstrap compiler ###
153 ###____________________###
157 _compiler=
158 _linker=
160 make_stage "$_this/bootstrap/$_host_cpu-cpfront-$_host_system" "$_host_cpu" "cpfront" "$_host_system" -b
161 else
163 fi
164 else
166 make_verify_stage 0
167 fi
169 ###^^^^^^^^^^^^^^^^^^###
170 ### Recompile itself ###
171 ###__________________###
175 make_verify_stage 1
176 fi
180 make_verify_stage 2
181 fi
183 ###^^^^^^^^^^^^^^^###
184 ### Cross compile ###
185 ###_______________###
190 fi