bugmake - Bugs: bug #54791, means to generate the list of...


bug #54791: means to generate the list of dependencies for a given target

Submitted by:  Markus Kuhn <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
Component Version:  4.1 Operating System:  Any
Fixed Release:  None Triage Status:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 05 Oct 2018 06:15:02 PM UTC, comment #1: 

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

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

Markus Kuhn <mgk25>
Fri 05 Oct 2018 06:04:20 PM UTC, original submission:  

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>)

Markus Kuhn <mgk25>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mgk25 (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    No changes have been made to this item

    Back to the top

    Powered by Savane 3.5