Documentation

Make script to silence output unless errors and always recompile

Categories
A
Adam Birds
Published 10 August 20261 min read1 views

Here is the script to silence output when running make unless their are errors, it will also always recompile too:

1. !/bin/bash

# Ensure no targets end with .c
args=""
invalid_args=0
for arg; do
case "$arg" in
(*.c) arg=${arg%.c}; invalid_args=1;;
esac
args="$args $arg"
done
if [ $invalid_args -eq 1 ]; then
echo "Did you mean 'make$args'?"
exit 1
fi

# Run make
/usr/bin/make -B -s $*

Copy the above into the below file:

/usr/local/bin/make

Then run:

sudo chmod +x /usr/local/bin/make
Last updated: 10 August 2026v1