Skip to content

Instantly share code, notes, and snippets.

@blockloop
Created May 14, 2019 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save blockloop/19b6a243d335463598a8e2450b4672ea to your computer and use it in GitHub Desktop.
Save blockloop/19b6a243d335463598a8e2450b4672ea to your computer and use it in GitHub Desktop.
debug Makefiles
#!/bin/sh
unset TERMCAP
re_env=$(env | cut -d= -f1 | tr \\n '|')
re_dot_smthg='\.[^ ]+'
re_autovars='[%*+<?^@][^ ]'
re_misc='GNUMAKEFLAGS|MAKE([^ ]+)?|MFLAGS|SUFFIXES|-\*-command-variables-\*-'
make -rR -pk -q "$@" \
| grep -Ev "^(${re_env}#|$re_dot_smthg|$re_autovars|$re_misc) " \
| cat -s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment