5 ###^^^^^^^^^^^^^^^^^^###
6 ### Global variables ###
7 ###__________________###
9 _this
="$(dirname "$(readlink -f "$0")")"
29 echo "Usage
: make-all.sh
[options
] cpu target os
"
31 echo " -c path Path to compiler binary
"
32 echo " -l path Path to linker binary
"
33 echo " -b Bootstrap compiler
(result
in bootstrap
/<cpu
>-cpfront-<os
>/)"
34 echo " -v Do not recompile itself
(result
in stage
2/)"
35 # echo " -e Cross compile
(result
in stage
-cross)"
36 # echo " -u cpu Host cpu
"
37 # echo " -s os Host operaion system
"
39 echo " 486 Intel
486+"
42 echo " cpfront Generic C
"
43 echo "Operation systems
:"
44 echo " linux GNU
/Linux
"
56 local _this_target="$3"
57 local _this_system="$4"
59 "$_this/make.sh
" -o "$_dir" -c "$_compiler" -l "$_linker" "$@
" "$_this_cpu" "$_this_target" "$_this_system"
60 if [ "$_target" = "cpfront
" ]; then
61 _compiler="$_dir/cpfront
"
64 if [ "$_cpu" = "486" ]; then
65 _compiler="$_dir/cpc486
"
66 _linker="$_dir/cpl486
"
68 error "unsupported cpu
$_cpu"
73 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
74 ### Parse arguments and options ###
75 ###_____________________________###
77 while getopts c:l:u:s:bveh _name
80 c) _compiler="$OPTARG" ;;
81 l) _linker="$OPTARG" ;;
82 u) _host_cpu="$OPTARG" ;;
83 s) _host_system="$OPTARG" ;;
91 if [ "$(expr $# - $OPTIND + 1)" != "3" ]; then
95 shift $(($OPTIND - 1))
100 if [ -z "$_host_cpu" ]; then
104 if [ -z "$_host_system" ]; then
105 _host_system="$_system"
108 ###^^^^^^^^^^^^^^^^^^^^^^^^^###
109 ### Link bootstrap compiler ###
110 ###_________________________###
113 echo "==> Bootstrap from C
"
117 make_stage "$_this/bootstrap
/$_host_cpu-cpfront-$_host_system" "$_host_cpu" "cpfront
" "$_host_system" -b
119 make_stage "$_this/bootstrap
/$_host_cpu-cpfront-$_host_system" "$_cpu" "cpfront
" "$_system" -b
123 ###^^^^^^^^^^^^^^^^###
124 ### Compile stages ###
125 ###________________###
130 make_stage "$_this/stage0
" "$_host_cpu" "native
" "$_host_system"
132 make_stage "$_this/stage1
" "$_host_cpu" "native
" "$_host_system"
134 make_stage "$_this/stage2
" "$_host_cpu" "native
" "$_host_system"
137 make_stage "$_this/stage0
" "$_cpu" "$_target" "$_system"
139 make_stage "$_this/stage1
" "$_cpu" "$_target" "$_system"
141 make_stage "$_this/stage2
" "$_cpu" "$_target" "$_system"
145 ###^^^^^^^^^^^^^^^###
146 ### Cross compile ###
147 ###_______________###
150 echo "==> Build
for target machine
"
151 make_stage "$_this/stage
-cross/$_cpu-$_target-$_system" "$_cpu" "$_target" "$_system"