Linux – GNU Make option. Print destination and prerequisites

GNU Make option. Print destination and prerequisites… here is a solution to the problem.

GNU Make option. Print destination and prerequisites

Hello, I would like to know if there is a feature in linux GNU Make that allows me to print targets and prerequisites that need to be run without actually running them! I’m tracking down a huge make environment and want to understand the process! Any other tips would be appreciated!

ex

$ make -option mytarget
making prereq to mytarget
making prereq to prereq
making prereq to prereq to prereq
making mytarget
done..... etc.

Solution

make

-n does “empty runs”, and the print command make will run without actually running them.

make -d prints out a lot of information on how to debug make is doing business and deciding which targets to build and in what order.

You can also combine the two. You might also want to learn about make -r, which will quiet down make –d by not checking any implicit rule output, make -k which will make things continue in case of an error (sometimes when making -n is executed, depending on how your makefile is set up):

From make(1) related part of man page:

-d
Print debugging information in addition to normal processing. The
debugging information says which files are being considered for
remaking, which file-times are being compared and with what
results, which files actually need to be remade, which implicit
rules are considered and which are applied — everything interesting about how make decides what to do.

-k, --keep-going
Continue as much as possible after an error. While the target that failed, and those that depend on it, cannot be remade, the other dependencies of these targets can be processed all the same.

-n, --just-print, --dry-run, --recon
Print the commands that would be executed, but do not execute
them.

-r, --no-builtin-rules
Eliminate use of the built-in implicit rules. Also clear out the
default list of suffixes for suffix rules.

Related Problems and Solutions