AutoTools: autoconf, automake, l

2020-11-05  本文已影响0人  iOSDevLog

autoconf package

image.png

A dataflow diagram for the autoreconf utility

What does ./bootstrap or ./autogen.sh do?

usually: call autotools commands to copy and generate a number of files. Often just autoreconf -vi.

gnulib provides a very elaborate bootstrap script, see VCS Issues, see Modified imports.

The name bootstrap is preferred over ‘autogen.sh’ as there also exists an independent software package named AutoGen.

image.png

A data flow diagram for autoconf and autoheader

automake

image.png

A data flow diagram for the compile and link processes

Standard Targets

Prefix Variables and Their Default Values

Variable Default Value
prefix /usr/local
exec_prefix $(prefix)
bindir $(exec_prefix)/bin
sbindir $(exec_prefix)/sbin
libexecdir $(exec_prefix)/libexec
datarootdir $(prefix)/share
datadir $(datarootdir)
sysconfdir $(prefix)/etc
sharedstatedir $(prefix)/com
localstatedir $(prefix)/var
includedir $(prefix)/include
oldincludedir /usr/include
docdir $(datarootdir)/doc/$(package)
infodir $(datarootdir)/info
htmldir $(docdir)
dvidir $(docdir)
pdfdir $(docdir)
psdir $(docdir)
libdir $(exec_prefix)/lib
lispdir $(datarootdir)/emacs/site-lisp
localedir $(datarootdir)/locale
mandir $(datarootdir)/man
manNdir $(mandir)/manN (N = 1..9)
manext .1
manNext .N (N = 1..9)
srcdir The source-tree directory corresponding to the current directory in the build tree

Some User Variables and Their Purposes

Variables Purpose
CC A reference to the system C compiler
CFLAGS Desired C compiler flags
CXX A reference to the system C++ compiler
CXXFLAGS Desired C++ compiler flags
LDFLAGS Desired linker flags
CPPFLAGS Desired C/C++ preprocessor flags

Makefile

CFLAGS = -g -O0

main: main.c
        $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<

bash

make CC=ccache CFLAGS='-g -O2' CPPFLAGS=-Dtest

Makefile

CFLAGS ?= -g -O0

m4

most like C-preprocessor (CPP)

bootstrap.sh

#!/bin/sh
autoreconf --install
automake --add-missing --copy >/dev/null 2>&1

AC_INIT

AC_INIT(package, version, [bug-report], [tarname], [url])

@PACKAGE_NAME@
@PACKAGE_VERSION@
@PACKAGE_TARNAME@
@PACKAGE_STRING@
@PACKAGE_BUGREPORT@
@PACKAGE_URL@

AC_CONFIG_SRCDIR

AC_CONFIG_SRCDIR(unique-file-in-source-dir)

AC_CONFIG_HEADERS

AC_CONFIG_XXXS(tag..., [commands], [init-cmds])

Unit Test

image.png

Data flow from maintainer-written input files to the testsuite program

参考:

  1. GitHub Code
  2. GNU AUTOCONF, AUTOMAKE, AND LIBTOOL
  3. 例解 autoconf 和 automake 生成 Makefile 文件
上一篇下一篇

猜你喜欢

热点阅读