Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
As I am new to linux, I am bit confused how build, ./configure, make, make install occurs...
I mean suppose I have written bunch of .c source files and few header files to support the function within .c files, I want to know how those will converted to binary images??? (I suppose that ./configure, make, make install are for this process)
Source files need to be "compiled" to be converted to a format that your machine and your OS can understand. The details will depend upon the language, the compiler, the architecture and the OS, but the basic is always the same. You write the program in a given language that you can (hopefully) understand with some given syntactic rules. Then you pass that program you wrote to a compiler, and a binary object is produced.
This binary file will contain object code that the machine should be able to understand (sometimes with the help of an intermediate interpreter, like usually happens with programs written in Java).
In Linux, C is a very common language to use, and the default C compiler in Linux is gcc. So that's what you use to compile a file written in C.
Make files are nothing but plain text files that hold a set of rules which define the hierarchy between the different source files that conform a given project. Attending to this Makefile, the "make" tool will call gcc (or whatever is needed) to compile all the files, link them together and produce a working binary.
This serves two purposes mainly: first, they instruct the make tool what files need to be compiled and in what order (some files might depend upon some others), and secondly, they instruct the make tool which files need to be recompiled when a given file changes, so you don't need to recompile *everything* each time a single .c file is modified. This actually saves time and simplifies the process when dealing with large projects that involve lots of separated source files.
The above process is not related to C or any other language. It's related to the build system you use. The build system takes care of building the Makefiles, which nowadays are rarely written by hand because of the size of the modern projects. Just think about the Linux kernel, KDE or Gnome to get an average idea. All of these have probably many millions of source code lines. Not a thing to be taken lightly.
The above scheme you've shown belongs to a project that's driven by what we know as the GNU toolchain, the GNU build system or simply "autotools". The configure script is just a shell script that searches for all the required libraries so the user doesn't have to guess all the dependencies by hand. It also allows the user to configure or enable (or even disable) some features at compilation time, some parts of the program or features that might be optional and can also affect the dependencies.
This configure script writes a "Makefile" that then the make tool will use to compile the rest of the files, which can be in C, but also in about any other language. C is just the common case, but not the only one. The make tool will call whatever compiler needs to be called.
The last line calls a target called "install", which usually does what its name says: install the files on your OS. The make tool works with targets. Without arguments it does the default target, which usually compiles the program. But that entirely depends on what the Makefile says. We can't teach you about Makefiles here, there's enough info on the net about both Makeifiles and autotools. There are also different build systems not based on autotools (i.e. CMake).