2 # Generate files for all apps,
3 # maybe build all apps,
4 # and produce a report listing differences from checked in copies.
6 # NOTE: This script doesn't rm -rf the previous run since it can run
7 # different tests. If you want to start fresh, rm -rf tmp-all yourself.
10 trap "echo ERROR: $(date)" 0
12 MPC_DIR="/path/to/mpc"
13 MPC_CONFIG="--with-mpc=${MPC_DIR}"
14 export LD_LIBRARY_PATH="${MPC_DIR}/lib"
16 echo "Starting gen-all: $(date)"
18 all_cgen_cpus="arm cris fr30 frv ip2k iq2000 lm32 m32c m32r mep mt \
19 openrisc sh sh64 xc16x xstormy16"
21 all_sid_cpus="arm m32r mep mt sh xstormy16"
33 cgen_cpus="${all_cgen_cpus}"
34 sid_cpus="${all_sid_cpus}"
39 cpus=*) cgen_cpus=${a/cpus=} sid_cpus=${cgen_cpus} ;;
40 config) do_config=yes ;;
41 build) do_build=yes ;;
42 binutils) do_binutils=yes ;;
44 newlib) do_newlib=yes ;;
47 intrinsics) do_intrinsics=yes ;;
48 diffs) do_diffs=yes ;;
60 *) echo "Invalid option: $a" >&2 ; exit 1 ;;
66 if echo " ${all_cgen_cpus} " | grep -q " ${c} "
70 echo "Invalid cgen cpu ${c}" >&2
74 if [ "${do_sid}" == "yes" ]
78 if echo " ${all_sid_cpus} " | grep -q " ${c} "
82 echo "Invalid sid cpu ${c}" >&2
92 # Paths to src,gcc,rel relative to ${build_dir}.
97 build_all_target_sys="fr30-elf"
98 build_sys=$(sh ${src}/config.guess)
106 if [ "${target_sys}" == "${build_all_target_sys}" ]
108 extra_config_args="${extra_config_args} --enable-targets=all"
113 true # already configured
114 elif [ "${do_config}" = "yes" ]
116 echo "Configuring: $(date)"
117 ../${src}/configure \
119 --build=${build_sys} \
121 --target=${target_sys} \
123 --enable-cgen-maint \
124 --enable-languages=c \
137 true # already configured
138 elif [ "${do_config}" = "yes" ]
140 echo "Configuring: $(date)"
141 ../${gcc}/configure \
143 --build=${build_sys} \
145 --target=${target_sys} \
146 --enable-languages=c \
155 PATH=${prefix}/bin:$PATH
157 echo "Building ${target_sys} binutils, $(date)"
158 mkdir -p tmp-src-${target_sys}
161 cd tmp-src-${target_sys}
163 config_src ${target_sys} ${prefix}
165 if [ "${do_build}" = "yes" ]
167 echo "Building: $(date)"
170 echo "Tree hasn't been configured."
173 make -j3 all-binutils all-gas all-ld
174 make -j1 install-binutils install-gas install-ld
175 echo "Build done: $(date)"
178 if [ $? != 0 ] ; then exit 1 ; fi
184 PATH=${prefix}/bin:$PATH
186 echo "Building ${target_sys} gcc, $(date)"
187 mkdir -p tmp-gcc-${target_sys}
190 cd tmp-gcc-${target_sys}
192 config_gcc ${target_sys} ${prefix}
194 if [ "${do_build}" = "yes" ]
196 echo "Building: $(date)"
199 echo "Tree hasn't been configured."
204 # FIXME: The toplevel makefile doesn't find ${target}-gcc,
205 # it sets CC_FOR_TARGET to ${target}-cc.
206 rm -f ${prefix}/bin/${target_sys}-cc
207 ln -s ${target_sys}-gcc ${prefix}/bin/${target_sys}-cc
208 echo "Build done: $(date)"
211 if [ $? != 0 ] ; then exit 1 ; fi
217 PATH=${prefix}/bin:$PATH
219 echo "Building ${target_sys} newlib, $(date)"
220 mkdir -p tmp-src-${target_sys}
223 cd tmp-src-${target_sys}
225 config_src ${target_sys} ${prefix}
227 if [ "${do_build}" = "yes" ]
229 echo "Building: $(date)"
232 echo "Tree hasn't been configured."
235 make -j3 all-target-newlib all-target-libgloss
236 make -j1 install-target-newlib install-target-libgloss
237 echo "Build done: $(date)"
240 if [ $? != 0 ] ; then exit 1 ; fi
246 PATH=${prefix}/bin:$PATH
248 echo "Building ${cpu} sim, $(date)"
249 mkdir -p tmp-src-${target_sys}
252 cd tmp-src-${target_sys}
254 config_src ${target_sys} ${prefix}
256 if [ "${do_build}" = "yes" ]
258 echo "Building: $(date)"
261 echo "Tree hasn't been configured."
264 make -j3 all-sim all-gdb
265 make -j1 install-sim install-gdb
266 echo "Build done: $(date)"
269 if [ $? != 0 ] ; then exit 1 ; fi
275 PATH=${prefix}/bin:$PATH
277 echo "Building ${cpu} sid, $(date)"
278 mkdir -p tmp-src-${target_sys}
281 cd tmp-src-${target_sys}
283 config_src ${target_sys} ${prefix}
285 if [ "${do_build}" = "yes" ]
287 echo "Building: $(date)"
290 echo "Tree hasn't been configured."
293 # SID doesn't support --enable-cgen-maint, sigh.
294 if [ ! -f sid/component/cgen-cpu/Makefile ]
296 make -j3 configure-sid
298 (cd sid/component/cgen-cpu && make cgen-all)
299 if [ $? != 0 ] ; then exit 1 ; fi
302 echo "Build done: $(date)"
305 if [ $? != 0 ] ; then exit 1 ; fi
308 build_intrinsics () {
309 (cd .. && sh ./gen-all-intrinsics ${build_dir}/${gcc})
310 if [ $? != 0 ] ; then exit 1 ; fi
314 # NOTE: cvs will return with a non-zero exit code if there are diffs.
315 (cd ${src}/opcodes && cvs diff -du >${build_dir}/opcodes.diffs)
316 (cd ${src}/sim && cvs diff -du >${build_dir}/sim.diffs)
317 (cd ${src}/sid/component/cgen-cpu && cvs diff -du >${build_dir}/sid.diffs)
318 (cd ${gcc}/gcc/config/mep && svn diff -x -u >${build_dir}/gcc.diffs)
321 for cpu in ${cgen_cpus}
323 # FIXME: arm-eabi is preferred over arm-elf
324 target_sys=${cpu}-elf
325 prefix=$(cd ${reltop} && pwd -P)/rel-${target_sys}
326 [ $? != 0 ] && { echo "Error setting prefix" >&2 ; exit 1 ; }
329 if [ "${do_binutils}" = "yes" ]
331 build_binutils ${target_sys} ${prefix}
334 if [ "${do_sim}" = "yes" ]
336 build_sim ${target_sys} ${prefix}
339 if [ "${do_gcc}" = "yes" ]
341 # GCC doesn't support some cpus that cgen supports.
342 case ${target_sys} in
345 openrisc-* | or32-*) ;;
347 *) build_gcc ${target_sys} ${prefix} ;;
351 if [ "${do_newlib}" = "yes" ]
353 # Newlib doesn't support some cpus that cgen supports.
354 # We also can't build newlib if we don't have gcc.
355 case ${target_sys} in
358 openrisc-* | or32-*) ;;
360 *) build_newlib ${target_sys} ${prefix} ;;
365 for cpu in ${sid_cpus}
367 # FIXME: arm-eabi is preferred over arm-elf
368 target_sys=${cpu}-elf
369 prefix=$(cd ${reltop} && pwd -P)/rel-${target_sys}
370 [ $? != 0 ] && { echo "Error setting prefix" >&2 ; exit 1 ; }
373 if [ "${do_sid}" = "yes" ]
375 build_sid ${target_sys} ${prefix}
379 if [ "${do_intrinsics}" = "yes" ]
381 build_intrinsics ${target_sys} ${prefix}
384 if [ "${do_diffs}" = "yes" ]
386 build_diffs ${target_sys} ${prefix}
389 echo "Ending gen-all: $(date)"