For Programmers: Free Programming Magazines  


Home > Archive > VC Language > June 2005 > Generating makefile dependencies









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Generating makefile dependencies
Jonathan Turkanis

2005-06-04, 4:02 am

Hi,

Many compilers have a command-line option, usually -m or -M, to generate
dependencies for inclusion in a makefile. Does any version of the VC++ compiler
support such an option?

I know it used to be possible to do it through the IDE and that this feature was
abolished; I'm just interested in command-line options.

Best,
Jonathan


Arnaud Debaene

2005-06-04, 8:58 am

Jonathan Turkanis wrote:
> Hi,
>
> Many compilers have a command-line option, usually -m or -M, to
> generate dependencies for inclusion in a makefile. Does any version
> of the VC++ compiler support such an option?

No, ther is no such option. VC uses the project dependency information file
(.idb) that is generated at the first compilation with /Gm to get the
dependency graph of each .cpp file and avoid useless recompilations : there
is no need for the makefile-style implementation/headers dependency lists.

Arnaud
MVP - VC


Igor Tandetnik

2005-06-04, 3:58 pm

"Jonathan Turkanis" <technews@kangaroologic.com> wrote in message
news:ebw%23yMKaFHA.3048@TK2MSFTNGP12.phx.gbl
> Many compilers have a command-line option, usually -m or -M, to
> generate dependencies for inclusion in a makefile. Does any version
> of the VC++ compiler support such an option?


There is a /showIncludes option that dupms all the header files included
into a .cpp file, directly or indirectly. See if it helps.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


Jonathan Turkanis

2005-06-04, 8:58 pm

Arnaud Debaene wrote:
> Jonathan Turkanis wrote:
> No, ther is no such option. VC uses the project dependency
> information file (.idb) that is generated at the first compilation
> with /Gm to get the dependency graph of each .cpp file and avoid
> useless recompilations : there is no need for the makefile-style
> implementation/headers dependency lists.


Thanks.

Are the idb files only useful when building from the IDE, or can you tell the
command-line compiler to compile conditionally based on information in an idb
file?

> Arnaud
> MVP - VC


Jonathan


Jonathan Turkanis

2005-06-04, 8:58 pm

Igor Tandetnik wrote:
> "Jonathan Turkanis" <technews@kangaroologic.com> wrote in message
> news:ebw%23yMKaFHA.3048@TK2MSFTNGP12.phx.gbl
>
> There is a /showIncludes option that dupms all the header files
> included into a .cpp file, directly or indirectly. See if it helps.


This could work, together with /EP /P, but it would take some extra parsing, so
it's not idea.

Thanks.

Jonathan


Jonathan Turkanis

2005-06-04, 8:58 pm

Carl Daniel [VC++ MVP] wrote:
> Jonathan Turkanis wrote:
>
> Attached is a stand-alone Perl program that can be used to generate
> makefile dependencies for C/C++ code. I haven't used this script for
> years, so it may need modifications to work with current versions of
> Perl.


Thanks! I'll see what I can do with it.

BTW, what's the license/copyright?

> -cd


Jonathan


Carl Daniel [VC++ MVP]

2005-06-04, 8:58 pm

Jonathan Turkanis wrote:
> Carl Daniel [VC++ MVP] wrote:
>
> Thanks! I'll see what I can do with it.
>
> BTW, what's the license/copyright?


I wrote it ~10 years ago (this particular rev is from 1998) - it's never had
any official licence on it. Consider it public domain at this point.

-cd


Arnaud Debaene

2005-06-05, 8:58 pm

Jonathan Turkanis wrote:
> Arnaud Debaene wrote:
>
> Thanks.
>
> Are the idb files only useful when building from the IDE, or can you
> tell the command-line compiler to compile conditionally based on
> information in an idb file?


The compiler uses (or generates) the idb files when you specify /Gm (and
optionnaly /Fd to set the file name), this is independant of the IDE.

Arnaud
MVP - VC


Jonathan Turkanis

2005-06-05, 8:58 pm

Arnaud Debaene wrote:
> Jonathan Turkanis wrote:
[color=darkred]
[color=darkred]
>
> The compiler uses (or generates) the idb files when you specify /Gm
> (and optionnaly /Fd to set the file name), this is independant of the
> IDE.


Thanks, this is all I need to know, then. It wasn't completely clear from thge
documentation for /Gm, which talks about "projects".

> Arnaud
> MVP - VC


Jonathan


Arnaud Debaene

2005-06-06, 8:59 pm

Jonathan Turkanis wrote:
> Thanks, this is all I need to know, then. It wasn't completely clear
> from thge documentation for /Gm, which talks about "projects".


Well, in that case, "project" means that you must call cl.exe once, with all
the source files together...

Arnaud
MVP - VC


Jonathan Turkanis

2005-06-08, 4:02 am

Arnaud Debaene wrote:
> Jonathan Turkanis wrote:
>
> Well, in that case, "project" means that you must call cl.exe once,
> with all the source files together...


Okay. When I hear "project" I usually think IDE.

Thanks again.

> Arnaud
> MVP - VC


Jonathan


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com