前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >AutoTools: autoconf, automake, libtools

AutoTools: autoconf, automake, libtools

作者头像
iOSDevLog
发布2020-11-12 10:41:18
9180
发布2020-11-12 10:41:18
举报
文章被收录于专栏:iOSDevLogiOSDevLog

autoconf package

  • autoconf
  • autoreconf
  • autoheader
  • autoscan
  • autoupdate
  • ifnames
  • autom4te

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

  • $@ refers to the full target name of the current target or the archive filename part of a library archive target. This variable is valid in both explicit and implicit rules.
  • $% refers to a member of an archive and is valid only when the current target is an archive member—that is, an object file that is a member of a static library. This variable is valid in both explicit and implicit rules.
  • $? refers to the list of dependencies that are newer than the current target. This variable is valid in both explicit and implicit rules.
  • $< refers to the member of the dependency list whose existence allowed the rule to be chosen for the target. This variable is only valid in implicit rules.
  • $* refers to the current target name with its suffix deleted. This variable is guaranteed by POSIX to be valid only in implicit rules.

image.png

A data flow diagram for the compile and link processes

Standard Targets

  • all
  • install
  • install-html
  • install-dvi
  • install-pdf
  • install-ps
  • install-strip
  • uninstall
  • clean
  • distclean
  • mostlyclean
  • maintainer-clean
  • TAGS
  • info
  • dvi
  • html
  • pdf
  • ps
  • dist
  • check
  • installcheck
  • installdirs

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

代码语言:javascript
复制
CFLAGS = -g -O0

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

bash

代码语言:javascript
复制
make CC=ccache CFLAGS='-g -O2' CPPFLAGS=-Dtest

Makefile

代码语言:javascript
复制
CFLAGS ?= -g -O0

m4

most like C-preprocessor (CPP)

bootstrap.sh

代码语言:javascript
复制
#!/bin/sh
autoreconf --install
automake --add-missing --copy >/dev/null 2>&1

AC_INIT

代码语言:javascript
复制
AC_INIT(package, version, [bug-report], [tarname], [url])

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

AC_CONFIG_SRCDIR

代码语言:javascript
复制
AC_CONFIG_SRCDIR(unique-file-in-source-dir)

AC_CONFIG_HEADERS

  • Initialization
  • Check request processing
  • File instantiation request processing
  • Generation of the configure script
代码语言:javascript
复制
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 文件
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • autoconf package
  • What does ./bootstrap or ./autogen.sh do?
  • automake
    • Standard Targets
      • Prefix Variables and Their Default Values
        • Some User Variables and Their Purposes
          • m4
            • bootstrap.sh
            • Unit Test
            • 参考:
            领券
            问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档