当前位置:网站首页>The GNU build system experience tutorial: Hello world example with Autoconf and automake
The GNU build system experience tutorial: Hello world example with Autoconf and automake
2022-04-22 15:09:00 【Charming Sun】
One 、 install GNU Build system
In the installation GNU Four software packages are introduced before building the system :
Autoconf: Generate configure The configuration script ;
Automake: Generate makefile Templates ;
Libtool: Compile location independent code in a portable way and build shared libraries ;
Autotoolset: Generate all kinds of template files to help you develop all kinds of compliance GNU Code style portable source code .
Enter the following command to check if the latest version is installed :
$ autoconf --version
$ automake --version
$ libtool --version
This tutorial uses Autoconf 2.69,Automake 1.15 and Libtool 2.4.6.
If the above software package is not available , Please install it by yourself .
Two 、 Create the required files
Create the following three files in an empty directory ( The download link will be given later ):
hello.c
#include <stdio.h>
int main(void)
{
printf("Howdy world!\n");
return 0;
}
To compile C Language source file .
Makefile.am
bin_PROGRAMS = hello
hello_SOURCES = hello.c
The first line of the file specifies the name of the program , The second line specifies the path of the source code and the file name .
configure.ac
AC_INIT(hello,0.1)
AC_CONFIG_SRCDIR(hello.c)
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_PROG_INSTALL
AC_OUTPUT(Makefile)
AC_INIT The macro initializes the configuration script , The first parameter specifies the name of the package , The second parameter specifies the version number of the package ;
AC_CONFIG_SRCDIR The macro specifies the path and file name of the source file ;
AM_INIT_AUTOMAKE Macro declaration by Automake Automatic generation Makefile.in file ( Now don't understand );
AC_PROG_CC The macro checks the compiler available to the system , If the source file is C++ Please use AC_PROG_CXX macro ;
AC_PROG_INSTALL Macro checks whether the system is installed BSD Compatible with installation tools (BSD compatible install utility);
AC_OUTPUT The macro tells the installation script to start from Makefile.in File generation Makefile file .
3、 ... and 、 Enter the command to generate the package
Enter the following commands in order :
$ aclocal
$ autoconf
$ touch README AUTHORS NEWS ChangeLog
$ automake -a
$ ./configure
$ make
$ ./hello
aclocal The command installs a program called aclocal.m4 The file of ;
autoconf Combination of orders aclocal.m4 Document and configure.ac File generation configure Script ;
touch The command is calling automake The command was created before, including READEME Several documents, including Automake Documents needed ;
automake The command checks whether the necessary files are missing and generates Makefile.in file ;
./configure Whether the command analysis system has installed the software and library that the software depends on ;
make Command compilation software ;
./hello Command execution procedure .
Then you can type # make install Command to install software , Input # make uninstall Command to uninstall the software .
Last input make distcheck Generate hello-0.1.tar.gz Release software .
Four 、 install 、 Use 、 Uninstall package
Enter the following commands in order :
$ gunzip hello-0.1.tar.gz
$ tar xf hello-0.1.tar
$ cd hello-0.1
$ ./configure
$ make
# make install
$ ./hello
# make uninstall
This software package can be used without # make install And # make uninstall.
hello-0.1.tar.gz Download link :
Hello world example with Autoconf and Automake.
5、 ... and 、 Further study
The following links are provided for further study Autotools And GNU Build system
GNU Automake
Autotools Tutorial for Beginners
The GNU configure and build system
Learning the GNU development tools
版权声明
本文为[Charming Sun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204221504282934.html
边栏推荐
- 如何通过云效Projex项目协同提高团队更高效的协作能力
- Goldfish rhca memoirs: rh358 managing DNS and DNS server -- troubleshooting DNS problems
- Raspberry Pi B的UART极简例程
- SMB+MSSQL
- Redis optimization series (I) building redis master-slave based on docker
- ROS通信机制三---参数服务器
- 人脸识别 (4) 人脸对齐
- When there is only input and output in flinksql, it will be merged into a subtask. In this case, the amount of input and output data cannot be displayed?
- [Mysql] CHAR_ Length function
- [World Earth Day] Huawei cloud market | witness the beautiful changes of nature with science and technology
猜你喜欢
![【深入理解TcaplusDB技术】读取列表指定位置数据接口说明——[List表]](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
【深入理解TcaplusDB技术】读取列表指定位置数据接口说明——[List表]

2022焊工(初级)操作证考试题库及答案

Record an SQL, query the company where the user last worked, and search according to the enterprise name + user name

如何选择电流钳或电流探头
![【深入理解TcaplusDB技术】读取列表指定位置数据示例代码——[List表]](/img/7b/8c4f1549054ee8c0184495d9e8e378.png)
【深入理解TcaplusDB技术】读取列表指定位置数据示例代码——[List表]

分布式任务调度平台XXL-JOB安装及使用

Introduction notes to golang - redis

Merge two ordered linked lists -- leetcode

*CTF2022 - Web

运输层——运输层概述(1)
随机推荐
为什么别人做自媒体月入过万?你每天才几毛几块?有哪些变现方式?
Upgrade the source database to version 5.0, restart the mongoshake service, and then report an error
A young man's first acquaintance
Transport layer UDP protocol
情报研判分析平台建设,情指勤一体化管理系统开发
PAT甲级1012:The Best Rank (25)
leetcode746. 使用最小花费爬楼梯(简单)
Android UI - zoomcontrols zoom in and out pictures, Android interview resume template
【深入理解TcaplusDB技术】异步扫描数据示例代码——[Generic表]
[Mysql] CHAR_ Length function
【深入理解TcaplusDB技术】示例代码——异步调用接口
合并两个有序链表——LeetCode
靠谱的教育金理财产品哪个最合适?
[World Earth Day] Huawei cloud market | witness the beautiful changes of nature with science and technology
SMB+MSSQL
运输层——运输层概述(1)
How to import Cisco evng image simulator
In the second half of the smart watch, opportunities and challenges coexist
Redis面试题汇总,mysql索引优化面试题常问
【深入理解TcaplusDB技术】读取数据示例代码——[Generic表]