3 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
5 # This file is part of GNU Emacs.
7 # GNU Emacs 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 3 of the License, or
10 # (at your option) any later version.
12 # GNU Emacs 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 GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
20 # This script is meant to be used as ./admin/emake, and will compile
21 # the Emacs tree with virtually all of the informational messages
22 # removed, and with errors/warnings highlighted in red. It will also
23 # run the test files belonging to files that have changed. It'll give
24 # a quick overview to confirm that nothing has broken, for instance
25 # after doing a "git pull". It's not meant to be used during actual
26 # development, because it removes so much information that commands
27 # like `next-error' won't be able to jump to the source code where
30 # It has a few options:
31 # with --no-color errors/warnings are not highlighted
32 # with --no-check test files are not run
33 # with --no-fast the FAST=true make variable is not set (see Makefile.in)
34 # with --quieter only errors/warnings remain visible
38 # Determine the number of cores.
39 if [ -f /proc
/cpuinfo
]; then
40 cores
=$
(($
(grep -E "^physical id|^cpu cores" /proc
/cpuinfo |\
41 awk '{ print $4; }' |\
53 [[ "X$1" == "X--no-color" ]] && { NOCOLOR
=1; shift; continue; }
54 [[ "X$1" == "X--no-check" ]] && { NOCHECK
=1; shift; continue; }
55 [[ "X$1" == "X--no-fast" ]] && { FASTOPT
=""; shift; continue; }
56 [[ "X$1" == "X--quieter" ]] && { QUIETER
=1; shift; continue; }
60 make $FASTOPT -j$cores "$@" 2>&1 | \
61 sed -u 's# \.\./\.\./# #
63 s#^Configuring local git # Configuring local git #
64 s#^Installing git hooks...# Installing git hooks...#
65 s#^Running # Running #
66 s#^Configured for # Configured for #
69 s#^Dumping under the name.*# \\& #
72 grep -E --line-buffered -v "^make|\
75 INFO.*Scraping.*[.] ?\$|\
76 INFO.*Scraping.*done\$|\
99 ^Source file.*newer than|\
100 ^Directories for loaddefs|\
103 ^.Read INSTALL.REPO for more|\
104 ^Your system has the required tools.|\
105 ^Building aclocal.m4|\
106 ^Building 'aclocal.m4'|\
107 ^ Running 'autoreconf|\
108 ^You can now run './configure'|\
110 ^configure: creating|\
111 ^\"configure\" file built.|\
112 ^There seems to be no|\
118 The GNU allocators don't work|\
124 ^'build-aux/git-hooks|\
125 ^GNUmakefile:[0-9]*: There seems to be no |\
126 ^GNUmakefile:[0-9]*: Running |\
127 ^GNUmakefile:[0-9]*: No Makefile|\
132 ^if test -f \./\.gdbinit|\
136 ^\[ \"\.\" = \"\.\" \]\
143 [[ "X${REPLY:0:1}" != "X " ]] && E
=1
144 [[ "X${REPLY:0:3}" == "X " ]] && E
=1
145 (($NOCOLOR == 0)) && (($E == 1)) && C
="\033[1;31m"
146 (($NOCOLOR == 0)) && (($E == 1)) && C
="\033[1;31m"
149 (($E == 0)) && printf "%s\n" "$REPLY" ||
printf "${C}%s\033[0m\n" "$REPLY"
151 (($E == 0)) && printf "%-${L}s\r" "$REPLY" || printf "${C}%-${L}s\033[0m\n" "$REPLY"
157 # If make failed, exit now with its error code.
158 ((${PIPESTATUS[0]} != 0)) && exit ${PIPESTATUS[0]}
160 (($NOCHECK == 1)) && exit 0
162 # Run a "make check" on all test files belonging to files that have
163 # changed since last time.
164 make -j$cores check-maybe
2>&1 | \
165 sed -n '/contained unexpected results/,$p' | \
166 grep -E --line-buffered -v "^make" | \
171 printf "\033[1;31m%s\033[0m\n" "$REPLY"
173 printf "%s\n" "$REPLY"