Basics on GNU autotools developing environment

GNU Autotools will be considered as the ideal tool to manage Fortran project after creating a basic program structure by using Eclipse IDE. Eclipse IDE is quite convenient for developing a simple project, however, only one target binary can be generated, i.e. a single binary executable or library. Therefore, it is still not good enough to manage a large or a collaborated project in which a couple of binaries should be generated with various types, such as executable binaries, static or shared libraries and test programs. One more comment should be added here: for a collaborated project, each team member has his own scope of module to be implemented and modules contributed from different members should cooperate seamlessly. This usually requires each member write his own test code to ensure quality and validity of the program. Therefore, there must be at least a couple of executable binaries in a collaborated project, which can’t be directly handled by Eclipse IDE. This is what GNU Autotools aim for.

GNU Autotools comprise two parts: Autoconf and Automake. Autoconf is used to create automation scripts for performing system tests (such as dependencies on some header files, libraries, etc.) and configurations which are adapted to different system architectures. Hence, the source code can be made cross-platform. Automake is useful for transforming a user maintained file Makefile.am into Makefile.in by conforming to GNU Make standard. Makefile plays the core role to record source code file dependencies and to determine the execution process of compiler and linker. In the following, only the concept of dependency tree is described, which provides you with most of the underlying ideas about what GNU Make is for.

If we want to compile a program executing some mathematical calculations, we create a file named main.f90, which contains the source code of main program. Let’s assume that main.f90 depends on two modules: MathFunc and Defs. MathFunc is defined and implemented in MathFunc.f90 and it contains user defined mathematical functions and constants. Defs is defined and implemented in Defs.f90 and it contains some special ID numbers for the standard I/O and other files. Furthermore, module MathFunc depends on Defs because some constants defined in Defs may be used. With these relations, a dependency tree can be generated as in Figure 1. We can see that a Fortran source file is compiled into an object file (*.o) and object files are linked into a binary file main.exe. If a module is defined in a source file, a *.mod file will also be generated. This *.mod file contains information about function, subroutine and variable declarations, which is equivalent to header file in C or C++ with the difference that it is automatically generated by Fortran compiler.

After the dependency relation is clear, GNU Make takes over the responsibility to ensure that if any node in the dependency tree has some changes, then this node and all of its parent nodes will be recompiled and the generated object files will be relinked into the final binary target. During this procedure, file timestamp is used to determine if there is any file changes and it is obvious to see that only requisite compiling is performed by GNU Make, which will greatly reduce the compiling time when the project gradually becomes larger.

With the above short introductions, we’ve got a basic concept of program development by using GNU tool chains. And this lays out a foundation for possible detailed learning of Autoconf and Automake in the future.

Figure 1 Dependency tree

Basics on GNU autotools developing environment,布布扣,bubuko.com

时间: 2024-10-21 08:22:02

Basics on GNU autotools developing environment的相关文章

GNU Autotools的使用方法

手工写Makefile是一件很有趣的事情,对于比较大型的项目,如果有工具可以代劳,自然是一件好事.在Linux系统开发环境中,GNU Autotools 无疑就充当了这个重要角色.(在Windows系统的开发环境中,IDE工具,诸如Visual Studio,来管理项目也很方便.) 本文以一个简单项目为例子,来讲述GNU Autotools的一列工具及其命令的用法. autotools是系列工具, 它主要由autoconf.automake.perl语言环境和m4等组成:所包含的命令有五个:  

Linux江湖23:使用Eclipse和Gnu Autotools管理C/C++项目

在我该系列的之前的所有随笔中,都是采用 Linux 发行版自带的包管理工具(如 apt-get.yum 等)进行软件的安装和卸载,从来没有向大家展示使用源代码自行编译安装软件的方法.但是长期混迹于 Unix/Linux 世界的童鞋们都知道,从源代码自行编译安装软件并不是那么的难,一般都是这样三个步骤: configure make make install 之所以能够把源代码的构建管理得如此简单,这得益于 Gnu 的 Autotools 工具链.在上面的三个命令中,configure 是一个脚本

Mac下安装MacProt,并GNU autotools的安装和使用 autoconf,automake

1 MacPort的下载:http://www.macports.org/install.php, 需要安装xCode支持macport 2 安装MacPorts 与其他Mac的软件的安装方式相同,挂载dmg后,打开pkg,按照引导一步步next,然后没有drag到Application的动作. (注:这一步骤非常慢.有的网友说是断了网就好了,如果这样的话,或许是在更新一些多余信息.) 3 然后将/opt/local/bin和/opt/local/sbin添加到$PATH搜索路径中  编辑/et

GNU Autotools的研究(转)

最近对Linux下软件项目的构建过程研究了一番.Linux下的软件项目通常用Autotools工具集和make工具来构建,我们通常使用./configure.make.make install这样的命令来编译安装软件包,则这样的项目一般就是使用Autotools工具集来构建,再加上GNU make工具来编译安装.   使用Autotools的目的:  (1)构建可移植的软件包.在不同操作系统上(主要是不同的类Unix系统),可能同样功能函数名称的不同,同样功能的库的名字的不同,以及头文件的不同,

gnu autotools

[libtool] compile config.guess config.sub depcomp install-sh ltmain.sh missing [automake] compile config.guess config.sub depcomp install-sh missing $> autoreconfig -ivf configure.ac 系统会从/usr/share/automake-1.11目录中复制config.guess config.sub到当前目录 $> l

Setup and configure an open source Fortran development environment on Windows

We must have already been familiar with proprietary Fortran programming environments, for example, Compaq Visual Fortran IDE (which is actually a combination of Microsoft’s Visual Studio 6 IDE and Compaq’s Fortran compiler along with commercial numer

Autotools发展史

在linux下面撸过代码.做过开发的,想必都听说过Makefile. 对,是Makefile,不是make love.如果你看成了后者,只能说:同志,你的三观有问题,需要格式化你的硬盘~ 在linux开发程序,没有集成开发环境IDE(integrated development environment),没有VC++6.0, 只有Makefile和冰冷黑漆漆的shell窗口,寒冷的夜,考验着每一个工程师疲惫的心 Makefile语法复杂.难以维护.对于一个小项目还好,对于大型的项目和开源项目,现

Autotools使用流程【转】

本文转载自:http://blog.csdn.net/scucj/article/details/6079052 手工写Makefile是一件很有趣的事情,对于比较大型的项目,如果有工具可以代劳,自然是一件好事.在Linux系统开发环境中,GNU Autotools 无疑就充当了这个重要角色.(在Windows系统的开发环境中,IDE工具,诸如Visual Studio,来管理项目也很方便.) 本文以一个简单项目为例子,来讲述GNU Autotools的一列工具及其命令的用法. autotool

使用autotools自动生成Makefile并在此之上使用dh-make生成可发布的deb程序包(详解)

转自:http://blog.csdn.net/longerzone/article/details/12705507 一.前言 本文将介绍如何使用autotools生成一个Makefile文件,并在此基础上使用dh-make和debuild生成一个可发布的deb程序包,这也是我们在Linux下开发应用程序以及想要发布应用程序需要做的. 无论是在Linux还是在Unix环境中,make都是一个非常重要的编译命令.不管是自己进行项目开发还是安装应用软件,我们都经常要用到make或 make ins