Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] New build paradigms

Alain Magloire wrote:

This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C2A533.4217B400
Content-Type: text/plain

I actually don't think (1) is that hard to do.  Yes, you do need to figure
out the dependencies between translation units and the header files they
bring in.  This information would also be necessary to generate proper
makefiles that do incremental build.  However, it shouldn't be too difficult
to do.  Gcc provides an option, -M, to generate this for you and I've build
a perl script in the past to does the same.  But, as Chris mentioned, the
CDOM, or more properly, the indexer, should be able record what header files
a particular file includes for a particular set of build settings.  But that
will take some time to put in place.

Yes, and probably it will be possible to go further in finding the
dependencies.  Most C programmers(sic) do not even bother to put
the includes are to declare the functions before:

# cat main.c
int main() {
 int x = 0;

 printf("Hello world");

 /* define in file foo.c */
 foo();
 return 0;
}

The C parser by looking at the file can probably figure out
that there is a dependency on foo.c and tell the builder that it needs
to compile foo.c before main.c.  Usually this is done manually in
a Makefile
And one better than this, several compiler (watcom being one), will actually look at the headers and symbols being used and automatically provide default library linkage for you
if you don't override that behaviour.

Thanks,
Thomas



Back to the top