This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Newbie G77 questions .. mostly re switches


"John Aitchison" <jaitchis@lisp.com.au> writes:
> 
> Hi
> 
> I have installed G77 on a Win95 plantform and being new to G77 and to 
> GNU compilers in general and I find myself confused by a) the 
> sequence of events b) the switches.
> 
> Specifically, I want to compile some .F code and get a listing of the 
> code and the syntax errors in an output file. I have tried various 
> combinations of the -Wall -save-temps -o file -fsyntax-only and I 
> cannot seem to get a simple compilation listing.  Can anyone help ?

I don't quite know what you mean by a "compilation listing", but you
can get the errors redirected via shell redirection. Note that if you
use Win9x command shell, it's quite inadequate and you'll need a different 
program to redirect errors to a file (For redir borrowed from DJGPP, see 
ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/mingw32/ports/). If you
use Unix shell, you're all set:
  
  $ g77 -c foo.f > foo.log 2>&1

I believe NT cmd shell as something similar.

GNU C compilers do not provide an output code listing as such.

> 
> Secondly, I am unsure of what is going on with G77 and the sub 
> processes.
> a) does G77 generate C code like F2C .. or does it go straight to ASM 
> .. or ?

g77 is a compiler, not a translator. It's just like any other "front-end"
to gcc such as C and C++ ones.

If you're using my distribution, I've provided the documentation in two
different formats (HTML and GNU info), so you may want to look at those.

> 
> b) in the bin directory I have the following exe's .. do these all 
> form part of the process and in the sequence I have them ?
>  
>  G77 ?front end  .. 

g77 is the front-end that is what you should invoke when compiling and
linking f77 code.

  $ g77 -o foo.exe foo.f

or,

  $ g77 -c foo.f
  $ g77 -o foo.exe foo.o

>  F771 ?Fortran to C converter ?

This is the actual compiler that is not to be invoked by users.

You should NOT have f771 and cpp in the "bin" directory; rather, these
should be in the compiler directory buried deep under.

>  CPP  ? Preprocessor
>  GCC  C Compiler

And doubles as a language sensitive front-end to all languages as well. The
GCC driver looks at file extensions to see what language, ie., back-end 
compiler, it should invoke. eg., the following does the right thing when
compiling (linking is a different issue since gcc may not know specific
runtime support library for various languages):
  
  $ gcc -c foo1.c foo2.f foo3.cc

It'll invoke the C backend (cc1) for foo1.c, f77 backend (f771) for foo2.f
and c++ backend (cc1plus) for foo3.cc. 

>  AS    Assembler
>  LD Linker

Right.

> 
> I would appreciate any enlightenment.
> 

You seem to have figured it out already, so don't know how much enlightenment
others can provide. 

It's quite instructive however to invoke the front-ends (such as gcc, g77,
c++, etc) with the -v option to see what really happens under the hood.
  
  $ g77 -c -v foo.f
  $ g77 -v -o foo.exe foo.o

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]