hthuan has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm looking for a script that looks at C/C++ source file and recursively find all dependent header files and paths.

Is there such a script exists? Can someone point me to it?

Thanks.
Thuan

Replies are listed 'Best First'.
Re: Find include files's paths
by indigo (Scribe) on Apr 27, 2001 at 03:16 UTC
    Try makedepend.

    It isn't Perl, but it is a semi-standard Unix utility, has been ported all over the place, and solves exactly this problem. You'll have to create a makefile, but since you're doing C/C++, there is a good chance you already have one.

    If you use the -f option, you'll get a nice delimited file Perl would be more than happy to munge for you.
      I need to these include paths to auto create makefiles. So your suggestion will not work. Thanks though. Thuan
Re: Find include files's paths
by lucs (Sexton) on Apr 27, 2001 at 15:18 UTC
    You might want to look at how the cons program does it (`cons' is a `make' replacement written in Perl.)