Skip to main content

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

Title: RE: [cdt-dev] New build paradigms

Actually, object files can be created in any order since the references aren't resolved until link time.  But that does bring up a great point about the order of the files on the link line since some of the linkers fail if you didn't have references before definitions (or visa versa, I can't remember the exact scenario, I've been spoiled too much lately by Visual Studio's automated build ;).  But, that's a whole other area that will need to be investigated for automated build.

Doug Schaefer
Senior Staff Software Engineer
Rational - the software development company
Ottawa (Kanata), Ontario, Canada
 

-----Original Message-----
From: Alain Magloire [mailto:alain@xxxxxxx]
Sent: Tuesday, December 17, 2002 7:34 PM
To: cdt-dev@xxxxxxxxxxx
Subject: 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



_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top