亚洲好骚综合-亚洲黄色录像-亚洲黄色网址-亚洲黄色网址大全-99久久99久久-99久久99久久精品国产

您的位置:軟件測試 > 開源軟件測試 > 開源配置管理工具 > cvs
CVS、Automake與Autoconf簡介
作者:網絡轉載 發布時間:[ 2012/12/28 14:18:46 ] 推薦標簽:

1. 用 autoscan 產生一個 configure.in 的原型,執行autoscan 后會產生一個configure.scan 的文件,可以用它作為 configure.in文件的藍本。
 
% autoscan
% ls
configure.scan hello.c

2. 編輯 configure.scan文件,如下所示,?且改名為configure.in

dnl Process this file with Autoconf to produce a configure script.
AC_INIT(hello.c)
AM_INIT_AUTOMAKE(hello, 1.0)
dnl Checks for programs.
AC_PROG_CC
dnl Checks for libraries.
dnl Checks for header files.
dnl Checks for typedefs, structures, and compiler characteristics.
dnl Checks for library functions.
AC_OUTPUT(Makefile)

3. 執行 aclocal 和 Autoconf ,分?會產生 aclocal.m4 及 configure 兩個文件

% aclocal
% Autoconf
% ls
aclocal.m4 configure configure.in hello.c

4. 編輯 Makefile.am 文件,?容如下

AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= hello
hello_SOURCES= hello.c

5. 執行 Automake --add-missing ,Automake 會根據Makefile.am 文件產生一些文件,包含重要的Makefile.in

% Automake --add-missing
Automake: configure.in: installing `./install-sh'
Automake: configure.in: installing `./mkinstalldirs'
Automake: configure.in: installing `./missing'

6. 后執行 ./configure:

% ./configure
creating cache ./config.cache
checking for a BSD compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... found
checking for working Autoconf... found
checking for working Automake... found
checking for working autoheader... found
checking for working makeinfo... found
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
updating cache ./config.cache
creating ./config.status
creating Makefile

$ ls
Makefile aclocal.m4 config.status hello.c mkinstalldirs
Makefile.am config.cache configure install-sh
Makefile.in config.log configure.in missing

?在你的目錄下已經產生了一個 Makefile 文件,輸入make指令可以編譯 hello.c 了!

% make
gcc -DPACKAGE="hello" -DVERSION="1.0" -I. -I. -g -O2 -c hello.c
gcc -g -O2 -o hello hello.o

你還可以試試 “make clean“,”make install“,”make dist“:
[root@localhost hello]# make clean
test -z "hello " || rm -f hello
rm -f *.o core *.core
[root@localhost hello]# make install
gcc -DPACKAGE="hello" -DVERSION="1.0" -I. -I. -g -O2 -c hello.c
gcc -g -O2 -o hello hello.o
make[1]: Entering directory `/home/joe/devel/hello'
/bin/sh ./mkinstalldirs /usr/local/bin
/usr/bin/install -c hello /usr/local/bin/hello
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/joe/devel/hello'
[root@localhost hello]# make dist
rm -rf hello-1.0
mkdir hello-1.0
chmod 777 hello-1.0
here=`cd . && pwd`;
top_distdir=`cd hello-1.0 && pwd`;
distdir=`cd hello-1.0 && pwd`;
cd .
&& Automake --include-deps --build-dir=$here --srcdir-name=. --output-dir=$top_distdir --foreign Makefile
chmod -R a+r hello-1.0
GZIP=--best gtar chozf hello-1.0.tar.gz hello-1.0
rm -rf hello-1.0
一切工作得很好! 當然,在make install時由于需要向系統目錄拷貝文件,您需要有root權限。

更進一步
上述產生Makefile 的過程和以往自行編寫的方式非常不一樣,使用 Automake 只需用到一些已經定義好的宏可以了。我們把宏及目標 (target)寫在Makefile.am 文件內,Automake 讀入 Makefile.am 文件后會把這一串已經定義好的宏展開并產生相對應的
Makefile.in 文件,然后再由configure這個 shell script 根據 Makefile.in 產生合適的Makefile。
具體流程如下所示:
代碼 --> [autoscan*] --> [configure.scan] --> configure.in
configure.in --. .------> Autoconf* -----> configure
+---+
[aclocal.m4] --+ `---.
[acsite.m4] ---' |
+--> [autoheader*] -> [config.h.in]
[acconfig.h] ----. |
+-----'
[config.h.top] --+
[config.h.bot] --'

Makefile.am -- [Autoconf*] -------> Makefile.in

.-------------> config.cache
configure* ------------+-------------> config.log
|
[config.h.in] -. v .-> [config.h] -.
+--> config.status* -+ +--> make*
Makefile.in ---' `-> Makefile ---'

上圖表示在整個過程中要使用的文件及產生出來的文件,有星號 (*) 代表可執行文件。在此示例中可由 Autoconf 及 Automake 工具所產生的額外文件有 configure.scan、aclocal.m4、configure、Makefile.in,需要加入設置的有configure.in 及 Makefile.am。 開發者要書寫的文件集中為confiugre.in和Makefile.am,在minigui項目中,我們把一系列的命令集中到一個批處理文件中:autogen.sh:

#!/bin/sh
aclocal
autoheader
Automake --add-missing
Autoconf

只要執行該批處理文件,結合configure.in和Makefile.am,可以生成需要的Makefile了。

編輯 configure.in 文件
Autoconf 是用來產生 'configure'文件的工具。'configure' 是一個 shell script,它可以自動設定一些編譯參數使程序能夠條件編譯以符合各種不同平臺的Unix 系統。Autoconf會讀取configure.in 文件然后產生'configure' 這個 shell script。

configure.in 文件內容是一系列GNU m4 的宏,這些宏經Autoconf處理后會變成檢查系統特性的shell scripts。 configure.in文件中宏的順序并沒有特別的規定,但是每一個configure.in 文件必須在所有其它宏前加入 AC_INIT 宏,然后在所有其它宏的后加上 AC_OUTPUT宏。一般可先用 autoscan 掃描原始文件以產生一個 configure.scan 文件,再對 configure.scan 做些修改成 configure.in 文件。在例子中所用到的宏如下:

dnl
這個宏后面的內容不會被處理,可以視為注釋

AC_INIT(FILE)
該宏用來檢查源代碼所在路徑,autoscan 會自動產生,一般無須修改它。 

上一頁1234下一頁
軟件測試工具 | 聯系我們 | 投訴建議 | 誠聘英才 | 申請使用列表 | 網站地圖
滬ICP備07036474 2003-2017 版權所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 大黄免费 | 中文字幕日本在线mv视频精品 | 亚洲欧美另类综合 | 香蕉大黄香蕉在线观看 | 99精品欧美一区二区三区美图 | 欧美日韩高清在线观看 | 91视频一88av | 免费视频网站一级人爱视频 | 亚洲成年人影院 | 黄色网址在线视频 | 一级黄色免费观看 | yy6080网午夜毛片一级 | 日韩一区二区视频在线观看 | 涩涩漫画入口 | 未成人禁止视频高清在线观看 | 一区二区在线不卡 | 日本高清va不卡视频在线观看 | 欧美日本一区 | 久久77 | 久久99精品久久久久久青青91 | 日本人欧美xx | 性欧美videofree另类 | 成人欧美视频免费看黄黄 | 精品亚洲欧美高清不卡高清 | 黄色在线免费看 | 日韩专区亚洲精品欧美专区 | 丁香六月狠狠激情综合基地 | 欧美三级超在线视频 | 中文字幕99页| 国产草莓视频入口免费网站 | 欧美不卡二区 | 免费在线成人网 | 国产一级片毛片 | 免费视频毛片 | 欧美一区二区三区综合色视频 | 老司机午夜性生免费福利 | 国产中文字幕久久 | 午夜国产精品免费观看 | 国产一线大片免费观看 | 久久第一页 | 欧美日韩大片 |