Use a dedicated type to represent interpreted-function values
[emacs.git] / admin / emake
blob93958740dc2f6b15785c40c76728a9621925bb66
1 #!/bin/bash
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
28 # errors are.
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
36 cores=1
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; }' |\
42 sed '$!N;s/\n/ /' |\
43 uniq |\
44 sed 's/^[0-9]*/+/')))
47 NOCOLOR=0
48 NOCHECK=0
49 FASTOPT="FAST=true"
50 QUIETER=0
51 while :
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; }
57 break
58 done
60 make $FASTOPT -j$cores "$@" 2>&1 | \
61 sed -u 's# \.\./\.\./# #
62 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 #
67 s#^./temacs.*# \\& #
68 s#^make.*Error# \\& #
69 s#^Dumping under the name.*# \\& #
70 :a;/\\$/N;s/\\\n//;ta
71 ' | \
72 grep -E --line-buffered -v "^make|\
73 ^Loading|\
74 SCRAPE|\
75 INFO.*Scraping.*[.] ?\$|\
76 INFO.*Scraping.*done\$|\
77 GEN.*etc/DOC|\
78 GEN.*autoloads|\
79 ^Waiting for git|\
80 ^Finding pointers|\
81 ^Using load-path|\
82 ^Adding name|\
83 ^Dump mode|\
84 ^Dumping finger|\
85 ^Byte counts|\
86 ^Reloc counts|\
87 ^Pure-hashed|\
88 ^cp -f temacs|\
89 ^rm -f bootstrap|\
90 ^Dump complete|\
91 ^rm -f emacs|\
92 mkdir -p etc|\
93 mkdir -p info|\
94 mkdir -p lisp|\
95 ^LC_ALL.*pdump|\
96 ^cp -f emacs.p|\
97 GEN.*loaddefs|\
98 ^Reloading stale|\
99 ^Source file.*newer than|\
100 ^Directories for loaddefs|\
101 ^./autogen.sh|\
102 ^[Cc]hecking |\
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'|\
109 ^./configure|\
110 ^configure: creating|\
111 ^\"configure\" file built.|\
112 ^There seems to be no|\
113 ^config.status:|\
114 ELN_DESTDIR|\
115 --bin-dest |\
116 ^ *$|\
117 ^Makefile built|\
118 The GNU allocators don't work|\
119 ^git config |\
120 ^'\.git/|\
121 ^\^\(\(|\
122 ^ANCIENT=yes make|\
123 ^touch -t|\
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|\
128 ^rm -f |\
129 ^rm -rf|\
130 ^find \. |\
131 ^rm -fr deps|\
132 ^if test -f \./\.gdbinit|\
133 ^true|\
134 ^for file in |\
135 ^rmdir|\
136 ^\[ \"\.\" = \"\.\" \]\
137 " | \
138 while read
140 C=""
142 [ ! -v L ] && L=80
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"
147 if (($QUIETER == 0))
148 then
149 (($E == 0)) && printf "%s\n" "$REPLY" || printf "${C}%s\033[0m\n" "$REPLY"
150 else
151 (($E == 0)) && printf "%-${L}s\r" "$REPLY" || printf "${C}%-${L}s\033[0m\n" "$REPLY"
153 L=${#REPLY}
154 (($L < 80)) && L=80
155 done
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" | \
167 while read
169 if (($NOCOLOR == 0))
170 then
171 printf "\033[1;31m%s\033[0m\n" "$REPLY"
172 else
173 printf "%s\n" "$REPLY"
175 done