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

Re: Generating makefile dependencies by Arnaud

Arnaud
Sat Jun 04 02:06:03 CDT 2005

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



Re: Generating makefile dependencies by Igor

Igor
Sat Jun 04 09:10:47 CDT 2005

"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



Re: Generating makefile dependencies by Jonathan

Jonathan
Sat Jun 04 16:06:17 CDT 2005

Arnaud Debaene wrote:
> 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.

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



Re: Generating makefile dependencies by Jonathan

Jonathan
Sat Jun 04 16:18:44 CDT 2005

Igor Tandetnik wrote:
> "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.

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

Thanks.

Jonathan



Re: Generating makefile dependencies by Jonathan

Jonathan
Sat Jun 04 16:20:12 CDT 2005

Carl Daniel [VC++ MVP] wrote:
> 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?
>>
>> 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.
>
> 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



Re: Generating makefile dependencies by Carl

Carl
Sat Jun 04 18:01:25 CDT 2005

Jonathan Turkanis wrote:
> Carl Daniel [VC++ MVP] wrote:
>> 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?
>>>
>>> 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.
>>
>> 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?

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



Re: Generating makefile dependencies by Arnaud

Arnaud
Sun Jun 05 14:37:28 CDT 2005

Jonathan Turkanis wrote:
> Arnaud Debaene wrote:
>> 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.
>
> 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



Re: Generating makefile dependencies by Jonathan

Jonathan
Sun Jun 05 14:58:51 CDT 2005

Arnaud Debaene wrote:
> Jonathan Turkanis wrote:
>> Arnaud Debaene 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.

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

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



Re: Generating makefile dependencies by Arnaud

Arnaud
Mon Jun 06 14:44:17 CDT 2005

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



Re: Generating makefile dependencies by Jonathan

Jonathan
Tue Jun 07 21:54:42 CDT 2005

Arnaud Debaene wrote:
> 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...

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

Thanks again.

> Arnaud
> MVP - VC

Jonathan