3 # Multi-build script for testing compilation of all maintained configs of GDB.
4 # Copyright (C) 2002 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 echo "Usage: gdb_mbuild.sh <srcdir> <builddir> [<parjobs>]"
23 echo " Environment variables examined (with default if not defined):"
24 echo " AWK (awk) -- must be GNU awk"
27 echo " Note: Everything in <builddir>/gdb-allcross will be blown away."
31 if [ $# -ne 2 -a $# -ne 3 ] ; then
35 ### COMMAND LINE PARAMETERS
37 # Where the sources live
40 # Where the builds occur
43 # Number of parallel make jobs (you probably want about 2 jobs per cpu for
51 ### ENVIRONMENT PARAMETERS
55 # Version of make to use
59 # Where builds will live
60 builddir=${buildbase}/gdb-allcross
62 # Where logs will go. NB. Must not be a sub-dir of builddir or you will loose
64 logdir=${buildbase}/gdb-logdir
66 # Where to look for the list of targets to test
67 maintainers=${srcdir}/gdb/MAINTAINERS
69 # Get the list of targets and the build options
70 alltarg=`${awk} < "${maintainers}" '
72 targets = gensub (/^.*--target=/, "", 1, $2)
73 warnings = gensub (/[)]*$/, "", 1, $3)
74 split (targets, targ, /,/)
76 print targ[i], warnings
80 # Back up the log files
85 mv build.out build.old
89 mv config.out config.old
96 if [ ! -d ${builddir} ]
98 echo ${builddir} does not exist
109 # For each target, configure and build it.
112 if [ ${opts} != "broken" ]
114 trap 'echo cleaning up ...; rm -rf ${builddir}/*; exit 1' 1 2 15
118 ${srcdir}/configure --target=$targ \
119 --enable-gdb-build-warnings=$opts \
120 >> ${logdir}/config.tout.$targ 2>&1 &
122 jobs=`expr ${jobs} + 1`
123 if [ ${jobs} -gt ${par} ]
135 cat ${logdir}/config.tout.* > ${logdir}/config.out
136 rm -f ${logdir}/config.tout.*
141 if ${make} -j ${par} all-gdb >> ${logdir}/build.out 2>&1
145 echo ">>>>>>>>>>>>>" >> ${logdir}/fail.sum
146 echo "$targ (${opts})" >> ${logdir}/fail.sum
147 tail -20 ${logdir}/build.out >> ${logdir}/fail.sum
148 echo >> ${logdir}/fail.sum
149 echo $targ build failed