#!/bin/bash # makelog - Redirect make's output into logfile usage() { echo "Usage: makelog ..." } if [ -z "$1" -o "$1" == "--help" ]; then usage exit 0 fi logfile=$(mktemp makelog.XXXXXX) trap "rm -f $logfile" EXIT params="$*" time make $params 2>&1 | tee $logfile mkdir -p build_tmp echo -e "\nmake $*:\n" >> build_tmp/make_${params// /_}.log cat $logfile >> build_tmp/make_${params// /_}.log