logo       

Equivalent to gcc -M to build a list of *objects*: msg#00095

gcc.help

Subject: Equivalent to gcc -M to build a list of *objects*

Hi !

I have a project with many files, and several files have a main()
function. (corresponding to different executables)

I'd like to generate the list of objects to be linked together to
build each executable, assuming that any function declared in a .h
file is implemented in the corresponding .c file (or .hh and .cc).

I've tried to use "gcc -M" on each file having a main function, and to
use something like sed 's/\.[ch]$/.o/', but this follows the
#include in the .h files. If I have some dependencies only in some .c
files, then, the list of objects is incomplete.

Is there an option to pass to GCC to accomplish this task ? Are there
some utilities doing this ? Do I have to do it myself ?

Thanks,

--
Matthieu



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise