Commit afdb545b authored by Yann E. MORIN's avatar Yann E. MORIN Committed by Thomas Petazzoni
Browse files

tools: new tool to filter the output of make

Add brmake, a small script that redirects the build output log to a
file, keeping just Buildroot's own messages, with the date+time added
at the start of the line.

We need to unbuffer the output of make so that, when the script is
interrupted (SIGINT, ^C), there is no lingering output not yet digested
by the logger loop.
Signed-off-by: default avatar"Yann E. MORIN" <>
Cc: Maxime Hadjinlian <>
Cc: Arnout Vandecappelle <>
Cc: Ricardo Martincoski <>
Cc: Samuel Martin <>
Signed-off-by: default avatarThomas Petazzoni <>
parent cb4184d9
......@@ -146,5 +146,6 @@ syntax, refer to[].
=== Support scripts
Some scripts in the +support/+ directory are written in Python and should follow
the[PEP8 Style Guide for Python Code].
Some scripts in the +support/+ and +tools/+ directories are written in
Python and should follow the[PEP8 Style Guide for Python Code].
# (C) 2016, "Yann E. MORIN" <>
# License: WTFPL,
main() {
local found ret start d h m mf
if ! which unbuffer >/dev/null 2>&1; then
printf "you need to install 'unbuffer' (from package expect or expect-dev)\n" >&2
exit 1
( exec 2>&1; unbuffer make "${@}"; ) \
> >( while read line; do
printf "%(%Y-%m-%dT%H:%M:%S)T %s\n" -1 "${line}"
done \
|tee -a br.log \
|grep --colour=never -E '>>>'
printf "Done in "
[ ${h} -eq 0 ] || { printf "%dh " ${h}; mf="02"; }
[ ${m} -eq 0 ] || { printf "%${mf}dmin " ${m}; sf="02"; }
printf "%${sf}ds\n" ${d}
return ${ret}
main "${@}"
......@@ -2,6 +2,15 @@ This directory contains various useful scripts and tools for working
with Buildroot. You need not add this directory in your PATH to use
any of those tools, but you may do so if you want.
a script that can be run instead of make, that prepends the date in
front of each line, redirects all of the build output to a file
("'br.log' in the current directory), and just outputs the Buildroot
messages (those lines starting with >>>) on stdout.
Do not run this script for interactive configuration (e.g. menuconfig)
or on an unconfigured directory. The output is redirected so you will see
a script that checks the coding style of a package's and
.mk files, and also tests them for various types of typoes.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment