使用Autotools编译项目(上)
首先创建工作目录:
mkdir try-autotools
int main() { printf("Hello, world!");}
% autoscan
% lsautoscan.log configure.scan helloworld.c
% mv configure.scan configure.in
% aclocal
% lsautom4te.cache autoscan.log configure.in helloworld.c
% autoheader
% lsautom4te.cache config.h.in configure.inautoscan.log configure helloworld.c
bin_PROGRAMS=helloworldhelloworld_SOURCES=helloworld.c
AM_INIT_AUTOMAKEAC_CONFIG_FILES([Makefile])
% touch AUTHORS ChangeLog INSTALL NEWS README
% automake -a
% autoreconf -vfi autoreconf: Entering directory `.'autoreconf: configure.in: not using Gettextautoreconf: running: aclocal --force autoreconf: configure.in: tracingautoreconf: configure.in: not using Libtoolautoreconf: running: /usr/bin/autoconf --forceautoreconf: running: /usr/bin/autoheader --forceautoreconf: running: automake --add-missing --copy --force-missingconfigure.in:6: installing `./missing'configure.in:6: installing `./install-sh'autoreconf: Leaving directory `.'
% lsAUTHORS Makefile.am aclocal.m4 config.h.in~ helloworld.cCOPYING Makefile.in autom4te.cache configure install-shChangeLog NEWS autoscan.log configure.in missingINSTALL README config.h.in depcomp
% ./configure
% makemake all-amgcc -DHAVE_CONFIG_H -I. -g -O2 -MT helloworld.o -MD -MP -MF .deps/helloworld.Tpo -c -o helloworld.o helloworld.chelloworld.c: In function 'main':helloworld.c:2: warning: incompatible implicit declaration of built-in function 'printf'mv -f .deps/helloworld.Tpo .deps/helloworld.Pogcc -g -O2 -o helloworld helloworld.o
% ./helloworld Hello, world!
% make distclean
% rm -rf autom4te.cache
% lsAUTHORS INSTALL NEWS config.h.in depcomp missingCOPYING Makefile.am README configure helloworld.cChangeLog Makefile.in aclocal.m4 configure.in install-sh