help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Retrieve used header and source file names from Makefile


From: Andrei Berceanu
Subject: Retrieve used header and source file names from Makefile
Date: Fri, 4 Jan 2019 17:12:20 +0200

Hi all,

I would like to extract all the *.cc and *.h filenames from a Makefile
that also contains unused targets.
Example Makefile here :
https://gist.github.com/berceanu/7554a9c4371b807e425259c7e99b5de9

I've tried running make -Bnd and looking at the pruned files but I
don't know if this misses anything:

make -Bnd | grep "Pruning file" | sort | uniq

Expected result: list of all *.h and *.cc files used by make run on
the above Makefile.

Another option would be to write a full Makefie parser in Python, but
that is a lot of work. Another thing I tried was

make --dry-run --print-data-base

but this results in output which is even harder to parse.

PS: cross post from
https://stackoverflow.com/questions/54029987/retrieve-used-header-and-source-file-names-by-parsing-makefile

Thanks,
Andrei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]