On Thu, Apr 19, 2001 at 02:28:00AM -0700, Tally Jones asked:
> what exactly is compiling. i have read the doc for
> compiling and at first it seems intimidating. i think
> compiling here is not the real compiling ie the one we
> do with a compiler to compile programs into
> executales. 

On Thu, Apr 19, 2001 at 06:36:25AM -0500, Mike Chambers replied:
> Don't know if this is right wording but you could basically say it's like
> when you get a program for windows, whether exe or zip file.  And you double
> click on it or unzip and run a setup program for it.  It goes and asks you
> certain questions to see what type setup your OS is and then finally
> installs on your computer.

Uh...not really.  That's really, usually, installation of a program or
system; one that's already been compiled, if it has to be.

> Same with linux, you are basically configuring the program then compiling
> (or running "make and make install" usually) it against your machine so it
> detects your architecture and what not, then installing it.  BTW, that is
> same with kernel, your configuring your kernel to your system then
> installing it.

No...

> Most often compiling programs is made up of..
> 
> configure
> make
> make install

That describes the external steps the user sees, and functionally is what
most need to know.  But there's a lot going on under the covers, bunky.

Compiling is a general term for the process of taking humanly-writable
and readable instructions to the computer and converting them into a form
that can be directly read and executed by the host operating system.

For instance, much code is written in a language like 'C' or 'C++'.
This is expressed in terms of tokens and identifiers that a human can
not only read and understand, but write (or at least, a lot of people
claim they can.  The quality of some code says they're exaggerating).
A _very_ small, meaningless snippet of C would be:

        register int iSomeNum, iIndex;

        for ( iIndex = 0, iSomeNum = 0; iIndex < 100; iIndex += 2 )
                iSomeNum += iIndex;

This would start both integer values iIndex and iSomeNum at zero, walk
iIndex to 100 by 2, and add the value of iIndex to iSomeNum every time
it was incremented.  I don't know why someone would want to do this, but
then, neither does the computer.

A program consists of many modules of such code.  In the case of
interpreters, such as the shell or Perl, the interpreter will actually
read such text and figure it out "on the fly".  This simplifies the
preparation and processing, but is slow and inefficient for a lot of
reasons we don't need to go into now.

If you can use another program--a compiler--to analyze the code, and
then reduce it to machine instructions--the actual binary codes that the
underlying CPU can manipulate--before trying to execute it, things are
_much_ faster.  Because there can be a LOT of code--sometimes hundreds of
thousands of lines-- it's more convenient to break this up into modules
that can individually be compiled into small segments, then joined
together later with a "linker" (a step often called "link editing").
Among other things, this avoids having to re-compile all the code every
time a change is made to a small section.  The combined process of compiling
and link-editing is usually generically called "building" or "a build",
and results in an "executable".

This is, with great simplification, what compiling means.  Now, in the sequence
mentioned before:

> configure

Before compiling, this usually customizes data to values appropriate for
the local system and intended usage.

> make

A utility that allows programmed management of the process of compilation
and link editing, and any other tasks related to preparing the system
for execution.  Actually doing the "build".

> make install

Actually taking any resulting executable(s) of the build and placing them,
along with any necessary supporting objects--man pages, configuration files,
etc.--in directories on the system such that they can actually be used.

I tried to keep this simple--please don't jump me for making it TOO simple.
(Or too complex--although questions are always welcome.)

Cheers,
-- 
        Dave "Now for some coffee" Ihnat
        [EMAIL PROTECTED]



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to