automake 筆記
$ ls hello.c
hello.c
$ cat hello.c
#include stdio.h
|
$ autoscan
$ ls
autoscan.log configure.scan hello.c
$ cp configure.scan configure.ac
$ vi configure.ac
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(hello, 1.0)
AC_CONFIG_SRCDIR([hello.c])
AC_CONFIG_HEADERS([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_OUTPUT(Makefile)
|
$ ls
autoscan.log configure.ac configure.scan hello.c
$ aclocal
$ ls
aclocal.m4 autom4te.cache autoscan.log configure.ac configure.scan hello.c
$ autoheader
$ ls
aclocal.m4 autom4te.cache autoscan.log config.h.in configure.ac configure.scan hello.c
$ autoconf
$ ls
aclocal.m4 autoscan.log configure configure.scan
autom4te.cache config.h.in configure.ac hello.c
$ vi Makefile.am
bin_PROGRAMS=hello
hello_SOURCES=hello.c
|
$ touch NEWS README AUTHORS ChangeLog
$ automake --add-missing
$ ls
aclocal.m4 autoscan.log config.h.in configure.scan hello.c Makefile.am NEWS
AUTHORS ChangeLog configure COPYING INSTALL Makefile.in README
autom4te.cache compile configure.ac depcomp install-sh missing
$ ./configure
$ ls
aclocal.m4 compile configure hello.c Makefile.in
AUTHORS config.h configure.ac INSTALL missing
autom4te.cache config.h.in configure.scan install-sh NEWS
autoscan.log config.log COPYING Makefile README
ChangeLog config.status depcomp Makefile.am stamp-h1
$ make
make all-am
make[1]: Entering directory '/home/samlin/hello'
gcc -DHAVE_CONFIG_H -I. -g -O2 -MT hello.o -MD -MP -MF .deps/hello.Tpo -c -o hello.o hello.c
mv -f .deps/hello.Tpo .deps/hello.Po
gcc -g -O2 -o hello hello.o
make[1]: Leaving directory '/home/samlin/hello'
$ ls
aclocal.m4 ChangeLog config.log configure.scan hello.c Makefile NEWS
AUTHORS compile config.status COPYING hello.o Makefile.am README
autom4te.cache config.h configure depcomp INSTALL Makefile.in stamp-h1
autoscan.log config.h.in configure.ac hello install-sh missing
$ ./hello
hello
沒有留言:
張貼留言