Linux生产makefile

1、 新建一个文件夹hello,进入hello文件夹,新建hello.c文件。

在这里插入图片描述
在这里插入图片描述2、使用gcc -c hello.c命令检查hello.c是否有语法错误。
在这里插入图片描述
3、安装autoscan命令,autoscan和autoheader都包含在autoconf工具中,所以只要安装autoconfig就可以了。

在这里插入图片描述

4、安装aclocal和automake。其中aclocal包含在automake工具中。
在这里插入图片描述
5、 执行autoscan,生成configure.scan.
在这里插入图片描述
6、修改configure.scan并重命名为configure.in。因为aclocal需要名为configure.in或configure.ac的文件。
在这里插入图片描述
在这里插入图片描述
7、运行aclocal和autoconf生成aclocal.m4和configure两个文件。
在这里插入图片描述
8、执行autoheader命令生成config.h.in
在这里插入图片描述
9、编写Makefile.am文件。
在这里插入图片描述
10、执行automake --add-missing命令。
在这里插入图片描述
11、执行./configure生成Makefile。
在这里插入图片描述
12、最后运行make命令进行编译生成可执行文件hello并运行。
在这里插入图片描述
13、运行成功,大功告成!!!

猜你喜欢

转载自blog.csdn.net/tianyake_1/article/details/83215387