Linux下Makefile生成技术
来源:互联网 发布:windows ping 1500 编辑:程序博客网 时间:2024/06/05 19:25
通过一段时间的Linux学习,基本上掌握了Linux下Makefile的生成技术
第一步:
新建文件Hello.c
#include <stdlib.h>
int main(void)
{
printf("Hello World!");
return 0;
}
第二步:
生成configure文件
利用autoscan命令生成configure.in的模板文件
命令:
$autoscan
$ls
configure.scan Hello.c
执行成功后会生成configure.scan文件,现将configure.scan重命名为configure.in,并编辑它。
$mv configure.scan configure.in
修改后的内容如下:
# -*- Autoconf -*- # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59) AC_INIT(Hello,0.0.1,[bujiwu@126.com]) #修改这行
AM_INIT_AUTOMAKE #增加这行 AC_CONFIG_SRCDIR([Hello.c])
#AC_CONFIG_HEADER([config.h]) 这行注释掉,否则后面会报找不到config.h文件
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files. # Checks for typedefs, structures, and compiler characteristics. # Checks for #library functions.
AC_CONFIG_FILES([Makefile]) #新增这行
AC_OUTPUT
然后执行命令aclocal和autoconf,分别会生成aclocal.m4及configure二个文件
$aclocal
$ls
aclocal.m4 configure.in Hello.c
$autoconf
aclocal.m4 autom4te.cache configure configure.in Hello.c
如果没有产生aclocal.m4,则是configure.in写的有错,更改后重新执行。
第三步:
新建Makefile.am
命令:
$vi Makefile.am
内容如下:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=Hello
Hello_SOURCES=Hello.c
第四步:
运行automake生成Makefile.in
命令:
$automake --add-missing
第五步:
执行configure 生成Makefile
$./configure
第六步:
再执行$make就生成Hello可执行文件
第一步:
新建文件Hello.c
#include <stdlib.h>
int main(void)
{
printf("Hello World!");
return 0;
}
第二步:
生成configure文件
利用autoscan命令生成configure.in的模板文件
命令:
$autoscan
$ls
configure.scan Hello.c
执行成功后会生成configure.scan文件,现将configure.scan重命名为configure.in,并编辑它。
$mv configure.scan configure.in
修改后的内容如下:
# -*- Autoconf -*- # Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59) AC_INIT(Hello,0.0.1,[bujiwu@126.com]) #修改这行
AM_INIT_AUTOMAKE #增加这行 AC_CONFIG_SRCDIR([Hello.c])
#AC_CONFIG_HEADER([config.h]) 这行注释掉,否则后面会报找不到config.h文件
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files. # Checks for typedefs, structures, and compiler characteristics. # Checks for #library functions.
AC_CONFIG_FILES([Makefile]) #新增这行
AC_OUTPUT
然后执行命令aclocal和autoconf,分别会生成aclocal.m4及configure二个文件
$aclocal
$ls
aclocal.m4 configure.in Hello.c
$autoconf
aclocal.m4 autom4te.cache configure configure.in Hello.c
如果没有产生aclocal.m4,则是configure.in写的有错,更改后重新执行。
第三步:
新建Makefile.am
命令:
$vi Makefile.am
内容如下:
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=Hello
Hello_SOURCES=Hello.c
第四步:
运行automake生成Makefile.in
命令:
$automake --add-missing
第五步:
执行configure 生成Makefile
$./configure
第六步:
再执行$make就生成Hello可执行文件
- Linux下Makefile生成技术
- Linux下自动生成 Makefile
- linux下makefile自动生成
- linux 下 automake 生成 makefile
- linux下自动化makefile生成
- linux 下自动化makefile生成
- linux下自动生成Makefile
- Linux下用automake生成makefile
- Linux下Makefile的automake生成
- linux下的Makefile的自动生成
- 自动生成Linux下Makefile全攻略
- Linux下Makefile的automake生成
- 自动生成Linux下Makefile全攻略
- Linux下Makefile的automake生成
- Linux下Makefile 的automake生成详解
- Linux下Makefile 的automake生成详解
- linux下automake生成makefile全攻略
- linux下的Makefile的自动生成
- C#如何将对象数组转换成DataSet
- 最近安装redhat enterprise as4 的感受!
- RDF与可视化
- 作业1
- 第一次作业
- Linux下Makefile生成技术
- ASP.NET Process Model 之:IIS 和 ASP.NET ISAPI
- IAD 名词解释
- 设计模式的设计原则
- 作业1
- 作业
- DaVinci之路@USTC --(1)
- 作业~~~~~~~~~~~~~
- 作业