In article <11************ **********@j4g2 000prf.googlegr oups.com>,
"ga************ *@gmail.com" <ga************ *@gmail.comwrit es
>Hi,
I want to know how to compile the C source file without using the
compiler directly. I mean to say by using compiler componets such as
( cpp, cc, as, ld ).
>cpp hello.c hello.i // Preprocessing
cc -S hello.i // Assembly code generating
as -o hello.o hello.s // generate m/c code
ld -o a.out hello.o -lc // linking
This is compiler specific. However all C compilers generally follow the
same steps.
Incidentally at one time compilers used to be 3 pass so your cc step
would have been
cc1
cc2
cc3
what has happened over the years is the three parts of the compiler have
been merged into one and in most the pre-processor as well.
They used to be separate because there was not enough memory etc to do
the whole lot at once and floppy disks held 360K (what hard disk?) . A
compiler/assembler/linker might be on three separate floppies.
These days the compiler will be able to "store" the temp files in memory
or quickly on the hard disk. Also the whole compiler can be called from
hard disk without having to swap floppies.
Many compilers are now "single pass" with the CPP and turn our object
code completely missing the assembler phase. So you would have
cc
ld
For your question MAKE was invented.
You call MAKE with a make file.
You have to write the makefile yourself, just the once and in future it
will call the compiler parts and the appropriate files.
Otherwise you could use a batch file or script. (This is al very basic
stuff)
Modern compiler suites use an IDE and that hides the makefile (or does
it's own similar thing) and compiler but under the covers it too calls
the compiler, linker assembler as above. Though in some compiler suites
they will be DLL's rather than stand alone exe programs with a command
line.
However you should have covered this in your initial programming
classes.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/
ch***@phaedsys. org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/