• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 319, comments - 22, trackbacks - 0, articles - 11
              C++博客 :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
            Configure,Makefile.am, Makefile.in, Makefile文件之間關(guān)系
            2009-08-12 12:14

            1.autoscan (autoconf): 掃描源代碼以搜尋普通的可移植性問(wèn)題,比如檢查編譯器,庫(kù),頭文件等,生成文件configure.scan,它是configure.ac的一個(gè)雛形。

            your source files --> [autoscan*] --> [configure.scan] --> configure.ac

            2.aclocal (automake):根據(jù)已經(jīng)安裝的宏,用戶定義宏和acinclude.m4文件中的宏將configure.ac文件所需要的宏集中定義到文件 aclocal.m4中。aclocal是一個(gè)perl 腳本程序,它的定義是:“aclocal - create aclocal.m4 by scanning configure.ac”
            user input files   optional input     process          output files
            ================ ============== ======= ============

            acinclude.m4 - - - - -.
            V
            .-------,
            configure.ac ------------------------>|aclocal|
            {user macro files} ->| |------> aclocal.m4
            `-------'
            3.autoheader(autoconf): 根據(jù)configure.ac中的某些宏,比如cpp宏定義,運(yùn)行m4,聲稱config.h.in

            user input files optional input process output files
            ================ ============== ======= ============

            aclocal.m4 - - - - - - - .
            |
            V
            .----------,
            configure.ac ----------------------->|autoheader|----> autoconfig.h.in
            `----------'

            4.automake: automake將Makefile.am中定義的結(jié)構(gòu)建立Makefile.in,然后configure腳本將生成的Makefile.in文件轉(zhuǎn)換 為Makefile。如果在configure.ac中定義了一些特殊的宏,比如AC_PROG_LIBTOOL,它會(huì)調(diào)用libtoolize,否則它 會(huì)自己產(chǎn)生config.guess和config.sub

            user input files   optional input   processes          output files
            ================ ============== ========= ============

            .--------,
            | | - - -> COPYING
            | | - - -> INSTALL
            | |------> install-sh
            | |------> missing
            |automake|------> mkinstalldirs
            configure.ac ----------------------->| |
            Makefile.am ----------------------->| |------> Makefile.in
            | |------> stamp-h.in
            .---+ | - - -> config.guess
            | | | - - -> config.sub
            | `------+-'
            | | - - - -> config.guess
            |libtoolize| - - - -> config.sub
            | |--------> ltmain.sh
            | |--------> ltconfig
            `----------'

            5.autoconf:將configure.ac中的宏展開(kāi),生成configure腳本。這個(gè)過(guò)程可能要用到aclocal.m4中定義的宏。

            user input files   optional input   processes          output files
            ================ ============== ========= ============

            aclocal.m4 ,autoconfig.h.in - - - - - - -.
            V
            .--------,
            configure.ac ----------------------->|autoconf|------> configure
             
            6. ./configure的過(guò)程

            .-------------> [config.cache]
            configure* --------------------------+-------------> config.log
            |
            [config.h.in] -. v .--> [autoconfig.h]
            +-------> config.status* -+
            Makefile.in ---' `--> Makefile
             
            7. make過(guò)程
             
            [autoconfig.h] -.
            +--> make* ---> 程序
            Makefile ---'
             
            .---------,
            config.site - - ->| |
            config.cache - - ->|configure| - - -> config.cache
            | +-,
            `-+-------' |
            | |----> config.status
            config.h.in ------->|config- |----> config.h
            Makefile.in ------->| .status|----> Makefile
            | |----> stamp-h
            | +--,
            .-+ | |
            | `------+--' |
            ltmain.sh ------->|ltconfig|-------> libtool
            | | |
            `-+------' |
            |config.guess|
            | config.sub |
            `------------'

            .--------,
            Makefile ------>| |
            config.h ------>| make |
            {project sources} ---------------->| |--------> {project targets}
            .-+ +--,
            | `--------' |
            | libtool |
            | missing |
            | install-sh |
            |mkinstalldirs|
            `-------------'
            實(shí)例:
            在/hello/目錄下創(chuàng)建一個(gè)hello.c文件,并編譯運(yùn)行它:

            #cd /hello/

            (1) 編寫源文件hello.c:

            #include<stdio.h>
            int main(int argc, char** argv)
            {
            printf("Hello, GNU!n");
            return 0;
            }

            [litao@vm0000131 hello]$ ll
            total 4
            -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c

            一、autoscan

            [litao@vm0000131 hello]$ autoscan
            autom4te: configure.ac: no such file or directory
            autoscan: /usr/bin/autom4te failed with exit status: 1
            [litao@vm0000131 hello]$ ll
            total 8
            -rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
            -rw-rw-r-- 1 litao litao 457 Aug 12 12:03 configure.scan
            -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c

            已經(jīng)生成了configure.scan,autoscan.log文件

            將configure.scan 修改為 configure.in,最后修改的內(nèi)容如下:

            [litao@vm0000131 hello]$ mv configure.scan configure.in
            [litao@vm0000131 hello]$ vim configure.in

            # -*- Autoconf -*-
            # Process this file with autoconf to produce a configure script.

            AC_PREREQ(2.59)
            AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
            AC_CONFIG_SRCDIR([hello.c])
            #AC_CONFIG_HEADER([config.h])
            AM_INIT_AUTOMAKE(hello, 1.0)
            # 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)

            二、acloacl

            [litao@vm0000131 hello]$ aclocal

            生成 aclocal.m4 和 autom4te.cache (生成aclocal.m4的過(guò)程中涉及到configure.in)

            [litao@vm0000131 hello]$ ll
            total 44
            -rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4
            drwxr-xr-x 2 litao litao 4096 Aug 12 12:08 autom4te.cache
            -rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
            -rw-rw-r-- 1 litao litao 496 Aug 12 12:08 configure.in
            -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c

            三、antoconf

            [litao@vm0000131 hello]$ autoconf
            生成 configure (根據(jù) configure.in, 和 aclocal.m4)
            [litao@vm0000131 hello]$ ll
            total 168
            -rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4
            drwxr-xr-x 2 litao litao 4096 Aug 12 12:11 autom4te.cache
            -rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
            -rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure
            -rw-rw-r-- 1 litao litao 496 Aug 12 12:08 configure.in
            -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c

            四、編寫Makefile.am:

            AUTOMAKE_OPTIONS= foreign
            bin_PROGRAMS= hello
            hello_SOURCES= hello.c

            五、automake

            生成 Makefile.in, depcomp, install-sh, 和 missing (根據(jù) Makefile.am, 和 aclocal.m4)

            [litao@vm0000131 hello]$ automake
            configure.in: required file `./install-sh' not found
            configure.in: required file `./missing' not found
            Makefile.am: required file `./depcomp' not found
            [litao@vm0000131 hello]$ automake --add-missing
            configure.in: installing `./install-sh'
            configure.in: installing `./missing'
            Makefile.am: installing `./depcomp'
            [litao@vm0000131 hello]$ ll
            total 192
            -rw-rw-r-- 1 litao litao 31120 Aug 12 12:08 aclocal.m4
            drwxr-xr-x 2 litao litao 4096 Aug 12 12:14 autom4te.cache
            -rw-rw-r-- 1 litao litao 0 Aug 12 12:03 autoscan.log
            -rwxrwxr-x 1 litao litao 122297 Aug 12 12:11 configure
            -rw-rw-r-- 1 litao litao 496 Aug 12 12:08 configure.in
            lrwxrwxrwx 1 litao litao 31 Aug 12 12:16 depcomp -> /usr/share/automake-1.9/depcomp
            -rw-rw-r-- 1 litao litao 68 Aug 12 12:02 hello.c
            lrwxrwxrwx 1 litao litao 34 Aug 12 12:16 install-sh -> /usr/share/automake-1.9/install-sh
            -rw-rw-r-- 1 litao litao 69 Aug 12 12:15 Makefile.am
            -rw-rw-r-- 1 litao litao 16561 Aug 12 12:16 Makefile.in
            lrwxrwxrwx 1 litao litao 31 Aug 12 12:16 missing -> /usr/share/automake-1.9/missing

            六、configure
            生成 Makefile, config.log, 和 config.status


            久久久无码精品亚洲日韩蜜臀浪潮| 久久99精品国产99久久6男男| 久久综合噜噜激激的五月天| 无码任你躁久久久久久老妇| 99久久精品免费看国产| www.久久99| 国产精品一久久香蕉国产线看| 亚洲精品无码久久久影院相关影片| 欧美午夜A∨大片久久 | 久久精品免费一区二区| 免费精品国产日韩热久久| 亚洲精品无码久久久久AV麻豆| 久久996热精品xxxx| 国产精品va久久久久久久| 久久AⅤ人妻少妇嫩草影院| 久久91精品综合国产首页| 亚洲国产精品一区二区三区久久| 久久久久久国产精品无码下载 | 97久久精品人人做人人爽| 亚洲一本综合久久| 久久精品国产第一区二区| 一本大道久久香蕉成人网| 中文国产成人精品久久不卡| 久久精品国产第一区二区三区| 精品久久久久久国产| 久久无码一区二区三区少妇 | 亚洲午夜久久影院| 无码精品久久一区二区三区| 亚洲va久久久噜噜噜久久男同| 国产精品无码久久综合| 久久久久亚洲av毛片大| 亚洲中文字幕无码一久久区| 久久99国产精品久久99| 污污内射久久一区二区欧美日韩 | 久久久久高潮毛片免费全部播放| 久久精品国产福利国产秒| 无码精品久久一区二区三区| 久久国产高潮流白浆免费观看| 国产真实乱对白精彩久久| 久久久久久夜精品精品免费啦| 激情综合色综合久久综合|