[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] New build paradigms
|
>
> 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
main : main.o foo.o
$(CC) -o main main.o foo.o
main.o: foo.o