I am working on a project which has a little complicated Makefile.
It has a lot of function calls and string substitutes to get the list of objects and phony targets.
I am trying to get the direct dependency on an target, e.g.
FOO_VAR := abc def ghi
test: \
foo \
bar \
$(FOO_VAR) \
whatever
I should get
foo
bar
abc
def
ghi
whatever
Even if these targets have further dependencies.
I have followed
List goals/targets in GNU make that contain variables in their definition
to use make -qp | awk -F':' '/^[a-zA-Z0-9][^$#\/\t=]*:([^=]|$)/ {split($1,A,/ /);for(i in A)print A[i]}'
However it will return all the targets, not just direct dependencies.