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) |