📅 2019-Dec-30 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cheatsheet, make ⬩ 📚 Archive
To view the actual and full commands executed by make while building its targets, use the commands from this post.
To a dry run:
$ make -n
This prints all the commands that would be executed, without actually executing them.
$ make -p
$ make -p -f/dev/null
$ make -w
This is useful, for example, to know which specific Makefile from a subdirectory is being used for running a specific command.
$ make -qp | awk -F ':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}' | sort -u
Quick Reference in the GNU Make Manual: My first stop to check Make’s directives, built-in functions, automatic variables and special variables.
Automatic Variables in the GNU Make Manual: About the variables that begin with $
.
Implicit Variables in the GNU Make Manual: About the variables for program names (like CC
) and arguments to programs (like CCFLAGS
).