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

您的位置:軟件測(cè)試 > 開源軟件測(cè)試 > 開源配置管理工具 > cvs
CVS、Automake與Autoconf簡(jiǎn)介
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2012/12/28 14:18:46 ] 推薦標(biāo)簽:

1. 用 autoscan 產(chǎn)生一個(gè) configure.in 的原型,執(zhí)行autoscan 后會(huì)產(chǎn)生一個(gè)configure.scan 的文件,可以用它作為 configure.in文件的藍(lán)本。
 
% 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. 執(zhí)行 aclocal 和 Autoconf ,分?會(huì)產(chǎn)生 aclocal.m4 及 configure 兩個(gè)文件

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

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

AUTOMAKE_OPTIONS= foreign
bin_PROGRAMS= hello
hello_SOURCES= hello.c

5. 執(zhí)行 Automake --add-missing ,Automake 會(huì)根據(jù)Makefile.am 文件產(chǎn)生一些文件,包含重要的Makefile.in

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

6. 后執(zhí)行 ./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

?在你的目錄下已經(jīng)產(chǎn)生了一個(gè) 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
一切工作得很好! 當(dāng)然,在make install時(shí)由于需要向系統(tǒng)目錄拷貝文件,您需要有root權(quán)限。

更進(jìn)一步
上述產(chǎn)生Makefile 的過程和以往自行編寫的方式非常不一樣,使用 Automake 只需用到一些已經(jīng)定義好的宏可以了。我們把宏及目標(biāo) (target)寫在Makefile.am 文件內(nèi),Automake 讀入 Makefile.am 文件后會(huì)把這一串已經(jīng)定義好的宏展開并產(chǎn)生相對(duì)應(yīng)的
Makefile.in 文件,然后再由configure這個(gè) shell script 根據(jù) Makefile.in 產(chǎn)生合適的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 ---'

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

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

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

編輯 configure.in 文件
Autoconf 是用來產(chǎn)生 'configure'文件的工具。'configure' 是一個(gè) shell script,它可以自動(dòng)設(shè)定一些編譯參數(shù)使程序能夠條件編譯以符合各種不同平臺(tái)的Unix 系統(tǒng)。Autoconf會(huì)讀取configure.in 文件然后產(chǎn)生'configure' 這個(gè) shell script。

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

dnl
這個(gè)宏后面的內(nèi)容不會(huì)被處理,可以視為注釋

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

上一頁1234下一頁
軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd
主站蜘蛛池模板: 日韩性freexxxx在线观看 | 伦理剧在线播放 | 日本人的色道免费网站 | www.日韩 | 成人丁香 | 男人下面桶女人视频免费 | 免费视频 久久久 | 日本精品久久久免费高清 | 黄漫无遮挡免费网站3d | 男人女人的免费视频网站 | 青草视频青年娱乐 | 国产亚洲3p无码一区二区 | 小明www永久免费播放平台 | 在线日韩中文字幕 | 久久精品大片 | 国产精品免费视频网站 | 极品精品国产超清自在线观看 | 韩日一级毛片 | 级毛片久久久毛片精品毛片 | 色吧久久| 亚洲w码欧洲s码免费 | 欧美一区二区三区成人看不卡 | 国产精品日韩在线观看 | 最近免费手机中文字幕3 | 在线视频免费观看a毛片 | 91精品国产免费久久国语蜜臀 | 中文字幕日韩在线 | 久久精品国产精品亚洲艾 | 韩国护士xxxxhd | 欧美精品午夜久久久伊人 | 波多野结衣视频在线免费观看 | 色版视频 | 久久99国产精品久久 | 一本大道香蕉久97在线视频 | 精品国产成a人在线观看 | 日韩美女片视频 | 天天搞夜夜爽 | www三级免费 | 天天做天天摸天天爽天天爱 | 国产亚洲精品看片在线观看 | 公妇乱淫日本免费观看 |