Obtaining software directly from the source code is a common procedure on Unix computers, and generally involves the following three steps:
- Configuring the
Makefile: [./configure] - Compiling the code : [
make] - Installing the executable : [
make install]
The challenge of cross-platform is simplified by using GNU's AutoTools
AutoTool : The GNU Build System, also known as the Autotools, is a suite of programming tools designed to assist in making source code packages portable to many Unix-like systems. Autotools consists of the GNU utility programs Autoconf, Automake, and Libtool.
- Makefile.am
- configure.ac
- Makefile.in
- Makefile
configure.ac Makefile.am
| |
[Autoconf] [Automake]
| |
configure script Makefile.in
\ /
\________________/
|
config.status
|
Makefile
|
[make]
|
(Executable)
-
Autoconf generates a
configurescript based on the contents of aconfigure.acfile which characterizes a particular body of source code. -
The
configurescript, when run, scans the build environment and generates a subordinateconfig.statusscript which, in turn, converts other input files and most commonlyMakefile.ininto output files (Makefile) -
Automake helps to create portable Makefiles, which are in turn processed with the
makeutility. -
It takes its input as
Makefile.am(programmer-defined file : so that they can write the make commands in developer friendly manner), and turns it intoMakefile.in. -
Finally the
makeprogram usesMakefileto generate executable programs from source code.
- Create
configure.acfile - Create
Makefile.amfile - run command
aclocal- first we need to generate
m4environment forautotoolsto use
- first we need to generate
- run command
autoconf- this command will generate
configurescript.
- this command will generate
- run command
automake --add-missing- this command will generate
Makefile.infile.
- this command will generate
- The end user doesn’t need to see our autotools setup, so we can distribute the
configurescript andMakefile.inwithout all of the files we used to generate them. - run command
./configure: to Generate Makefile fromMakefile.in - run command
make distcheck: Use Makefile to build and test a tarball to distribute
So on Maintainer's system:
aclocal # Set up an m4 environment
autoconf # Generate configure from configure.ac
automake --add-missing # Generate Makefile.in from Makefile.am
./configure # Generate Makefile from Makefile.in
make distcheck # Use Makefile to build and test a tarball to distribute
On the user's system:
./configure # Generate Makefile from Makefile.in
make # Use Makefile to build the program
make install # Use Makefile to install the program
To add a submodule
git submodule add -f -b master git@github.com:Vishwas1/democpplib.git lib/helloworld
First, we need to initialize the submodule(s). We can do that with the following command:
git submodule init
Then we need to run the update in order to pull down the files.
git submodule update
To remove a submodule?
- Remove the submodule’s entry in the .gitmodules file.
- Remove the submodule’s entry in the .git/config
- Remove the path created for the submodule by using the command below.
git rm --cached lib/helloworld
To get the HEAD of each submodule
git submodule foreach 'echo $path git rev-parse HEAD'
cd lib/helloworld./autogen.sh./configuremake
http://inti.sourceforge.net/tutorial/libinti/autotoolsproject.html
- static vs dynamic library.
- static vs dynamic linking.
- The Boost C++ Libraries are a collection of modern libraries based on the C++ standard.