Last active
July 13, 2016 00:52
-
-
Save sjessa/5e1565cb3af1949b9c867e1c4b88e713 to your computer and use it in GitHub Desktop.
log your make commands & output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: $ lmake <make options here> <optional make target> | |
function lmake () | |
{ | |
echo "Appending make command output to make.log" | |
echo "Running command..." | |
echo "" >>make.log | |
echo "------------------------------------------" >>make.log | |
echo " MAKE LAUNCHED" >>make.log | |
echo " start: $(date +"%Y-%m-%d %H:%M")" >>make.log | |
echo " command: make $@" >>make.log | |
echo "------------------------------------------" >>make.log | |
make $@ \ | |
2> >(perl -pe 'use POSIX strftime; print strftime "[%Y-%m-%d %H:%M:%S] [ERR]: ", localtime') \ | |
1> >(perl -pe 'use POSIX strftime; if ($_ =~ m/failed/) {print strftime "[%Y-%m-%d %H:%M:%S] [ERR]: ", localtime} else {print strftime "[%Y-%m-%d %H:%M:%S] [OUT]: ", localtime'}) \ | |
| tee -a make.log | |
echo "" >>make.log | |
echo "------------------------------------------" >>make.log | |
echo " MAKE COMPLETE" >>make.log | |
echo " end: $(date +"%Y-%m-%d %H:%M")" >>make.log | |
echo "------------------------------------------" >>make.log | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
log your make commands!
usage:
Add the
lmake
function to your.bashrc
and dosource ~/.bashrc
To run, simply replace
make
withlmake
in your command as in$ lmake <make options here> <optional make target>
example: