5 ###^^^^^^^^^^^^^^^^^^###
6 ### Global variables ###
7 ###__________________###
9 _this
="$(dirname "$(readlink -f "$0")")"
30 echo "Usage
: make-all.sh
[options
] cpu target os
"
32 echo " -c path Path to compiler binary
"
33 echo " -l path Path to linker binary
"
34 echo " -b Bootstrap compiler
(result
in bootstrap
/<cpu
>-cpfront-<os
>/)"
35 echo " -g num Set max verify stages
(0.
.2)"
36 # echo " -e Cross compile
(result
in stage
-cross)"
37 # echo " -u cpu Host cpu
"
38 # echo " -t target Host compiler
"
39 # echo " -s os Host operaion system
"
41 echo " 486 Intel
486+"
44 echo " cpfront Generic C
"
45 echo "Operation systems
:"
46 echo " linux GNU
/Linux
"
58 local _this_target="$3"
59 local _this_system="$4"
61 "$_this/make.sh
" -o "$_dir" -c "$_compiler" -l "$_linker" "$@
" "$_this_cpu" "$_this_target" "$_this_system"
62 if [ "$_target" = "cpfront
" ]; then
63 _compiler="$_dir/cpfront
"
66 if [ "$_cpu" = "486" ]; then
67 _compiler="$_dir/cpc486
"
68 _linker="$_dir/cpl486
"
70 error "unsupported cpu
$_cpu"
79 make_stage "$_this/stage
$_N" "$@
" "$_host_cpu" "$_host_target" "$_host_system"
81 make_stage "$_this/stage
$_N" "$@
" "$_cpu" "$_target" "$_system"
85 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
86 ### Parse arguments and options ###
87 ###_____________________________###
89 while getopts c:l:u:t:s:g:beh _name
92 c) _compiler="$OPTARG" ;;
93 l) _linker="$OPTARG" ;;
94 u) _host_cpu="$OPTARG" ;;
95 t) _host_target="$OPTARG" ;;
96 s) _host_system="$OPTARG" ;;
97 g) _stages="$OPTARG" ;;
104 if [ "$_stages" -lt "0" -o "$_stages" -gt "2" ]; then
108 if [ "$(expr $# - $OPTIND + 1)" != "3" ]; then
112 shift $(($OPTIND - 1))
117 if [ -z "$_host_cpu" ]; then
121 if [ -z "$_host_target" ]; then
122 _host_target="$_target"
125 if [ -z "$_host_system" ]; then
126 _host_system="$_system"
129 ###^^^^^^^^^^^^^^^^^^^^###
130 ### Bootstrap compiler ###
131 ###____________________###
138 make_stage "$_this/bootstrap
/$_host_cpu-cpfront-$_host_system" "$_host_cpu" "cpfront
" "$_host_system" -b
140 make_stage "$_this/bootstrap
/$_host_cpu-cpfront-$_host_system" "$_cpu" "cpfront
" "$_system" -b
147 ###^^^^^^^^^^^^^^^^^^###
148 ### Recompile itself ###
149 ###__________________###
151 for _N in $(seq 1 "$_stages")
154 make_verify_stage "$_N"
158 ###^^^^^^^^^^^^^^^###
159 ### Cross compile ###
160 ###_______________###
163 echo "==> Cross compile
"
164 make_stage "$_this/stage
-cross/$_cpu-$_target-$_system" "$_cpu" "$_target" "$_system"