Discussion:
[bug #54791] means to generate the list of dependencies for a given target
Markus Kuhn
2018-10-05 18:04:22 UTC
Permalink
URL:
<https://savannah.gnu.org/bugs/?54791>

Summary: means to generate the list of dependencies for a
given target
Project: make
Submitted by: mgk25
Submitted on: Fri 05 Oct 2018 06:04:20 PM UTC
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: 4.1
Operating System: Any
Fixed Release: None
Triage Status: None

_______________________________________________________

Details:

It would be very useful to have an official means of generating a list of all
files on which a given target depends.

One existing way to generate such a list is to parse the output of option -d
for "Considering" lines, as in:


$ make -Bndr <target-file> | perl -ne "/Considering target file '(.+)'./ &&
print \"\$1\\n\""


But this *hack* is based on a potentially unstable format of a debugging
function, so not something recommendable for production scripts.

It would be nice to have both a proper command-line option
"make -D <target>" and a function $(dependencies <target>) to generate such a
list for <target>.

Example application: I want to find out what is the latest git commit that
modified any of the dependencies of <target> (for example to derive a version
number for that target from that commit using "git describe"). Using the
proposed facilities, I could do that with


$ make -D <target> | xargs git log -n1 --pretty=format:%H --


or inside a Makefile


git log -n1 --pretty=format:%H -- $(dependencies <target>)






_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?54791>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
Markus Kuhn
2018-10-05 18:15:02 UTC
Permalink
Follow-up Comment #1, bug #54791 (project make):

The bug submission system oddly truncated my example lines, so here another
attempt:


$ make -Bndr <target> | \
perl -ne "/Considering target file '(.+)'./"' && print "$1\n"'
_______________________________________________________

Reply to this item at:

<https://savannah.gnu.org/bugs/?54791>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Loading...