A big project usually has a complicated Makefile system. There are lots of variable definitions and target-prerequisity dependencies scattered in different Makefiles. Any handy way to print all the prerequisites and build rules for a target?
To be specific, two questions:
Question 1
say I have four Makefiles:
Makefile1:
p: a b
[some rule]
Makefile2:
q: c d
[some rule]
Makefile3:
r: e f
[some rule]
Makefile:
all: p q r
[some rule]
Can I invoke some command to get some output similar to the following?
all: a b c d e f
[rule 1]
[rule 2]
[rule 3]
......
Question 2
And, what if the entity I want to examine is just an ordinary binary instead of a target specified in Makefile? For example, how can I get the prerequisites and build rules for sha1sum
in coreutils? (It is obvious there is no target named as sha1sum
in coreutils' Makefile.)
I have looked into the help and manual of make
, but in vain. Maybe I didn't figure out the correct keywords for googling. Can anyone help me? Thanks!
make -n
andgrep
recursively as a partical solution. Thanks! – antiAgainst