Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1181650
  • 博文数量: 181
  • 博客积分: 4968
  • 博客等级: 上校
  • 技术积分: 1867
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-13 21:52
文章分类

全部博文(181)

文章存档

2015年(2)

2013年(6)

2012年(22)

2011年(41)

2010年(27)

2009年(51)

2008年(32)

我的朋友

分类: LINUX

2011-09-15 15:56:10

1. make a helloworld program.
$ touch helloworld.c
$ vi helloworld.c
#include
#include
int main(int argc, char** argv)
{
 printf("Hello, Linux World!\n");
 return 0;
}
2. Run autoscan and edit the configure.in
$ autoscan
$ mv configure.scan configure.in

#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
# AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(helloworld.c)
AM_INIT_AUTOMAKE(helloworld, 1.0)
AC_CONFIG_SRCDIR([helloworld.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT(Makefile)
3. make a new file of config.h.in, and run aclocal and autoconf.
$ touch config.h.in
$ aclocal
$ autoconf
4. make a new file named Makefile.am.
$ touch Makefile.am
AUTOMAKE_OPTIONS=foreign
bin_PROGRAMS=hello
hello_SOURCES=hello.c
5. run atuomake.
$ automake --add-missing
configure.in: installing `./install-sh'
configure.in: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: installing `./COPYING'
6. Run configure to generate Makefile.
$ ./configure
7. make
$ make

The directory list as follow:
1. make a helloworld source file.
|-- step1
|   `-- helloworld.c
2. Run autoscan and edit the configure.in
|-- step2
|   |-- autoscan.log
|   |-- configure.in
|   |-- configure.scan
|   `-- helloworld.c
3. make a new file of config.h.in, and run aclocal and autoconf.
|-- step3
|   |-- aclocal.m4
|   |-- autom4te.cache
|   |   |-- output.0
|   |   |-- output.1
|   |   |-- requests
|   |   |-- traces.0
|   |   `-- traces.1
|   |-- autoscan.log
|   |-- config.h.in
|   |-- configure
|   |-- configure.in
|   `-- helloworld.c
4. make a new file named Makefile.am.
|-- step4
|   |-- Makefile.am
|   |-- README
|   |-- aclocal.m4
|   |-- autom4te.cache
|   |   |-- output.0
|   |   |-- output.1
|   |   |-- requests
|   |   |-- traces.0
|   |   `-- traces.1
|   |-- autoscan.log
|   |-- config.h.in
|   |-- configure
|   |-- configure.in
|   `-- helloworld.c
5. run atuomake.
|-- step5
|   |-- COPYING -> /usr/share/automake-1.9/COPYING
|   |-- INSTALL -> /usr/share/automake-1.9/INSTALL
|   |-- Makefile.am
|   |-- Makefile.in
|   |-- README
|   |-- aclocal.m4
|   |-- autom4te.cache
|   |   |-- output.0
|   |   |-- output.1
|   |   |-- requests
|   |   |-- traces.0
|   |   `-- traces.1
|   |-- autoscan.log
|   |-- config.h.in
|   |-- configure
|   |-- configure.in
|   |-- depcomp -> /usr/share/automake-1.9/depcomp
|   |-- helloworld.c
|   |-- install-sh -> /usr/share/automake-1.9/install-sh
|   `-- missing -> /usr/share/automake-1.9/missing
6. Run configure to generate Makefile.
|-- step6
|   |-- COPYING -> /usr/share/automake-1.9/COPYING
|   |-- INSTALL -> /usr/share/automake-1.9/INSTALL
|   |-- Makefile
|   |-- Makefile.am
|   |-- Makefile.in
|   |-- README
|   |-- aclocal.m4
|   |-- autom4te.cache
|   |   |-- output.0
|   |   |-- output.1
|   |   |-- requests
|   |   |-- traces.0
|   |   `-- traces.1
|   |-- autoscan.log
|   |-- config.h
|   |-- config.h.in
|   |-- config.log
|   |-- config.status
|   |-- configure
|   |-- configure.in
|   |-- depcomp -> /usr/share/automake-1.9/depcomp
|   |-- helloworld.c
|   |-- install-sh -> /usr/share/automake-1.9/install-sh
|   |-- missing -> /usr/share/automake-1.9/missing
|   `-- stamp-h1
`-- step7
7. make
    |-- COPYING -> /usr/share/automake-1.9/COPYING
    |-- INSTALL -> /usr/share/automake-1.9/INSTALL
    |-- Makefile
    |-- Makefile.am
    |-- Makefile.in
    |-- README
    |-- aclocal.m4
    |-- autom4te.cache
    |   |-- output.0
    |   |-- output.1
    |   |-- requests
    |   |-- traces.0
    |   `-- traces.1
    |-- autoscan.log
    |-- config.h
    |-- config.h.in
    |-- config.log
    |-- config.status
    |-- configure
    |-- configure.in
    |-- depcomp -> /usr/share/automake-1.9/depcomp
    |-- helloworld
    |-- helloworld.c
    |-- helloworld.o
    |-- install-sh -> /usr/share/automake-1.9/install-sh
    |-- missing -> /usr/share/automake-1.9/missing
    `-- stamp-h1
 
阅读(1306) | 评论(0) | 转发(0) |
0

上一篇:grep忽略svn文件

下一篇:统计代码行数

给主人留下些什么吧!~~