4 # Check different makes
6 # Copyright 2023 and 2024 Odin Kroeger.
8 # This file is part of Para.
10 # Para is free software: you can redistribute it and/or modify it
11 # under the terms of the GNU Affero General Public License as published
12 # by the Free Software Foundation, either version 3 of the License,
13 # or (at your option) any later version.
15 # Para is distributed in the hope that it will be useful, but WITHOUT
16 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General
18 # Public License for more details.
20 # You should have received a copy of the GNU Affero General Public
21 # License along with Para. If not, see <https://www.gnu.org/licenses/>.
24 # shellcheck disable=2015,2031
32 makes
='make bmake bsdmake gmake makepp remake'
46 scriptsdir
="$(cd "$
(dirname -- "$0")" && pwd)"
49 srcdir
="$(cd "$scriptsdir/..
" && pwd)"
52 # shellcheck disable=1091
53 .
"$srcdir/libutil.sh" ||
exit
55 mktmpdir
-d"$srcdir" ||
exit
62 # Current working directory
72 OPTARG
='' OPTIND
=1 opt
=''
73 # shellcheck disable=2034
74 while getopts 'dc:hqv' opt
76 # shellcheck disable=2154
79 $progname - test different makes
81 Usage: $progname [-c cc] [-d] [-q] [-v] [make ...]
85 -c cc Use cc as C compiler.
86 -d Enable debugging mode.
88 -v Show, rather than log, test output.
89 -h Show this help screen.
102 # shellcheck disable=2086
103 [ $# -eq 0 ] && set -- $makes
105 # Use a fast compiler, if one is available
108 for cc
in tcc clang c99 cc
110 if command -v "$cc" >/dev
/null
117 [ "${CC-}" ] && export CC
124 warn
-q 'Copying source tree...'
126 logged
-d"$wd" make -e distar
="$TMPDIR/dist.tgz" dist
=dist
"$TMPDIR/dist.tgz"
130 warn
-q 'Configuring build...'
131 logged
-d"$wd" .
/configure
141 absfname
="$(command -v "$make" 2>/dev/null)" ||
continue
143 while [ "$i" -lt "$nmakes" ]
145 eval seenmake
="\"\${make_$i-}\""
146 # shellcheck disable=2154
147 if cmp "$absfname" "$seenmake" >/dev
/null
2>&1
149 warn
'%s has already been checked as %s' \
150 "$make" "${seenmake##*/}"
155 eval "make_$nmakes"='$absfname'
156 nmakes
="$((nmakes + 1))"
158 warn
'Checking %s...' "$make"
159 logged
-d"$wd" "$make" -e mrproper
&&
160 logged
-d"$wd" "$make" -e all ||
161 failures
="$failures$make, "
165 then err
'Failures: %s' "${failures%, }"
166 else warn
-qc32 'All makes passed'