1 #! /bin/sh
3 set -e
5 ###^^^^^^^^^^^^^^^^^^###
6 ### Global variables ###
7 ###__________________###
11 _cpu=
12 _target=
13 _system=
14 _compiler=
15 _linker=
16 _docompile=true
17 _dolink=true
20 _useposix=false
22 ###^^^^^^^^^^^###
23 ### Functions ###
24 ###___________###
26 usage() {
41 exit 2
42 }
44 error() {
46 exit 1
47 }
49 copy_source() {
50 for _src
51 do
54 fi
55 done
56 }
58 native_compile() {
60 }
62 native_link() {
65 fi
66 }
68 cpfront_import_list() {
69 echo
71 do
73 shift
76 fi
77 done
78 }
80 cpfront_main_module() {
82 shift
84 }
86 cpfront_compile() {
88 }
90 cpfront_link() {
95 fi
96 shift
98 local _list=
100 do
102 done
105 -Wno-int-conversion \
106 -Wno-int-to-pointer-cast \
107 -Wno-incompatible-pointer-types \
108 -Wno-implicit-function-declaration \
110 fi
111 }
113 compile() {
118 esac
119 }
121 link() {
126 esac
127 }
129 compile_all() {
130 ###^^^^^^^^^^^^^^^^^^^^^^^^###
131 ### Compile POSIX bindings ###
132 ###________________________###
135 compile Posix/Mod/Ctypes.cp \
136 Posix/Mod/Csys_types.cp \
137 Posix/Mod/Cstdlib.cp Posix/Mod/Cstdio.cp Posix/Mod/Cunistd.cp \
138 Posix/Mod/Cdirent.cp Posix/Mod/Clocale.cp Posix/Mod/Ctime.cp \
139 Posix/Mod/Csys_stat.cp Posix/Mod/Cfcntl.cp Posix/Mod/Cerrno.cp \
140 Posix/Mod/Ciconv.cp Posix/Mod/Cwctype.cp Posix/Mod/Csys_mman.cp \
141 Posix/Mod/Cdlfcn.cp Posix/Mod/Csignal.cp Posix/Mod/Csetjmp.cp \
142 Posix/Mod/Clibgen.cp \
143 Posix/Mod/Cmacro.cp
144 fi
146 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
147 ### Compile BlackBox Framework ###
148 ###____________________________###
150 compile System/Mod/Int.odc
152 compile System/Mod/Long.odc
153 compile System/Mod/Math.odc System/Mod/SMath.odc
154 else
155 compile System/Mod/Math.cp System/Mod/SMath.cp
156 fi
157 compile System/Mod/Kernel.cp \
158 System/Mod/Console.odc System/Mod/Files.odc System/Mod/Dates.odc \
159 System/Mod/Log.odc System/Mod/Strings.odc System/Mod/Services.odc \
160 System/Mod/Integers.odc
163 mv -t System Code Sym
164 fi
166 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
167 ### Compile Linux Host subsystem ###
168 ###______________________________###
170 compile Host/Mod/Lang.cp Host/Mod/Dates.cp Host/Mod/Console.cp \
171 Host/Mod/Files.cp
173 ###^^^^^^^^^^^^^^^^^^^^^^^###
174 ### Compile Dev subsystem ###
175 ###_______________________###
177 compile Dev/Mod/CPM.cp Dev/Mod/CPT.odc Dev/Mod/CPS.odc Dev/Mod/CPB.odc \
178 Dev/Mod/CPP.odc Dev/Mod/CPE.odc Dev/Mod/CPH.odc Dev/Mod/CPL486.odc \
179 Dev/Mod/CPC486.odc Dev/Mod/CPV486.odc
181 ###^^^^^^^^^^^^^^^^^^^^^^^^###
182 ### Compile Dev2 subsystem ###
183 ###________________________###
185 compile Dev2/Mod/LnkBase.odc Dev2/Mod/LnkChmod.odc Dev2/Mod/LnkLoad.odc \
186 Dev2/Mod/LnkWriteElf.odc Dev2/Mod/LnkWriteElfStatic.odc \
187 Dev2/Mod/LnkWritePe.odc
189 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^###
190 ### Compile CPfront subsystem ###
191 ###___________________________###
193 compile CPfront/Mod/CPG.odc CPfront/Mod/CPC.odc CPfront/Mod/CPV.odc
195 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
196 ### Compile bbdsw-specific modules ###
197 ###________________________________###
200 compile Dsw/Mod/Debug.odc
201 fi
202 compile Dsw/Mod/Documents.cp Dsw/Mod/Log.odc Dsw/Mod/Compiler486Main.cp \
203 Dsw/Mod/CompilerCPfrontMain.cp Dsw/Mod/Linker486Main.cp
204 }
206 link_all() {
207 local _debug_module=
209 _debug_module=DswDebug
210 fi
212 link cpc486 \
213 PosixCtypes PosixCmacro \
214 Kernel Console Files Dates Math Strings Services Log \
216 DevCPM DevCPT DevCPS DevCPB DevCPP DevCPE DevCPH \
217 DevCPL486 DevCPC486 DevCPV486 \
218 DswDocuments DswCompiler486Main
220 link cpl486 \
221 PosixCtypes PosixCmacro \
222 Kernel Console Files Math Strings Services Log \
224 Dev2LnkBase Dev2LnkChmod Dev2LnkLoad Dev2LnkWriteElf \
225 Dev2LnkWriteElfStatic Dev2LnkWritePe \
226 DswLinker486Main
228 link cpfront \
229 PosixCtypes PosixCmacro \
230 Kernel Console Files Dates Math Strings Services Log \
232 DevCPM DevCPT DevCPS DevCPB DevCPP DevCPE DevCPH \
233 CPfrontCPG CPfrontCPC CPfrontCPV\
234 DswDocuments DswCompilerCPfrontMain
237 chmod a+x cpc486 cpl486 cpfront
238 fi
239 }
241 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
242 ### Parse arguments and options ###
243 ###_____________________________###
245 while getopts c:l:o:bxh _name
246 do
251 b) _docompile=false ;;
252 x) _dolink=false ;;
253 h|?) usage ;;
254 esac
255 done
258 usage
259 fi
266 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
267 ### Check for supported cpu/target/os ###
268 ###___________________________________###
271 386|486|586|686) _cpu=486 ;;
274 esac
277 native) _target=native ;;
278 cpfront|c) _target=cpfront ;;
281 esac
284 linux) _useposix=true ;;
287 esac
289 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
290 ### Select default compiler if not specified ###
291 ###__________________________________________###
295 native)
297 486) _compiler=cpc486 ;;
299 esac
300 ;;
301 cpfront) _compiler=cpfront ;;
303 esac
304 fi
308 native)
310 486) _linker=cpl486 ;;
312 esac
313 ;;
314 cpfront) _linker= ;;
316 esac
317 fi
322 else
324 fi
325 fi
330 else
332 fi
333 fi
335 ###^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^###
336 ### Copy sources for changed system ###
337 ###_________________________________###
346 fi
351 fi
355 ###^^^^^^^^^^^^^^^###
356 ### Build modules ###
357 ###_______________###
360 compile_all
361 fi
363 ###^^^^^^^^^^^^^^###
364 ### Link modules ###
365 ###______________###
367 link_all