Retrieve used header and source file names from Makefile

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Retrieve used header and source file names from Makefile

Andrei Berceanu
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

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make