This article mentioned in references is an awesome place for getting idea of how the GNU build system works
1. How to build executable from available open source software packages
2. How the whole system works for generating scripts and makefiles, which are the basic infrastructure for building and installing software executables.
Below are the three golden steps in the GNU system to build and install the software
1. ./configure => finds out the local environment, check whether packages required are already installed and if everything OK, then write the make files.
2. make => make build the binary executables
3. sudo make install => make install installs the executable.
Below diagram gives good idea of which are the files and processes involved in the build process.
Below are few more commands that may be useful
make check => this can be given between make and make install and this runs a set of regression tests assuming these were included in the software by the developers
make clean => removes all the files made by make and make check but not the files written by the configure.
make distclean => If the intent was to remove the files written by configure as well as start fresh.
make maintainer-clean => it removes all the files that make distclean removes and also removes the files that developer has automatically generated using the GNU build system.
make uninstall => uninstalls the software
make dist => makes the compressed archive distribution package
make distcheck => makes the distribution, unpacks in a sub directory configures, makes the executables and runs the regression test suites to check if everything is OK.
Now lets see what are the pre-requites for GNU build system.
- the system should have GNU gcc compiler
- GNU make
- GNU m4 macro processor version 1.4.5 or above
- GNU tar programs
- autoconf, automake, libtool
Functions of Autoconf
A GNU package may be distributed as source code and it should be possible to make executable under various Posix like systems. This means a developer will have to write make files for each of the platform adapted to it. This is a gigantic task and the Autoconf tool simplifies it. Autoconf tool generate configure (shell script to create make files) adapted to the system in which it has to run. Autoconf tool takes text files configure.ac (former name, configure.in) The configure.ac contains macros to check a system for features that a software package might use. autoconf invokes the m4 macro processor to generate the configure the script.
Functions of Automake
Automaker is a tool for generating the file Makefile.in from a template file Makefile.am
Functions of Autoheader
auto header program scans the configure.ac and generates the file config.h.in containing info about all the preprocessor macros that need to be defined.
aclocal program creates the file aclocal.m4 containing the macro definitions required by autoconf.
references:
No comments:
Post a Comment