青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

Creative Commons License
本Blog采用 知識(shí)共享署名-非商業(yè)性使用-禁止演繹 3.0 Unported許可協(xié)議 進(jìn)行許可。 —— Fox <游戲人生>

游戲人生

游戲人生 != ( 人生 == 游戲 )
站點(diǎn)遷移至:http://www.yulefox.com。請(qǐng)訂閱本博的朋友將RSS修改為http://feeds.feedburner.com/yulefox
posts - 62, comments - 508, trackbacks - 0, articles - 7

Autotools初體驗(yàn)

Posted on 2009-12-23 02:18 Fox 閱讀(6955) 評(píng)論(5)  編輯 收藏 引用 所屬分類(lèi): T技術(shù)碎語(yǔ)

本文同步自游戲人生

Writen by Fox(yulefox.at.gmail.com)


從接觸和使用make以來(lái),前前后后寫(xiě)了不少M(fèi)akefile(添添減減、修修補(bǔ)補(bǔ),累計(jì)上千行是有的),今天在重新整理代碼的組織結(jié)構(gòu)之后,突然就想:我為什么不使用Autotools呢?

在開(kāi)始體驗(yàn)功能強(qiáng)大的Autotools之前,簡(jiǎn)單(詳細(xì))回憶總結(jié)一下我使用make的經(jīng)歷和思考的過(guò)程,反省一下看看自己在接觸這些新鮮事物的時(shí)候到底走了多少?gòu)澛贰?/p>

o Cygwin

今年3月份,拜Kevin Lynx所賜,每次對(duì)Linu淺嘗輒止的我終于下決心接觸了Cygwin環(huán)境,并一發(fā)不可收拾。

剛開(kāi)始的時(shí)候,就像大學(xué)剛接觸編程那樣,寫(xiě)“hello, world”,在終端用gcc命令直接編譯,然后開(kāi)始寫(xiě)最簡(jiǎn)單的只有一個(gè)all的Makefile。因?yàn)镋macs、GCC、make對(duì)我來(lái)說(shuō)都是嶄新的 工具,后面重心就不是放在寫(xiě)代碼上了,而是急于掌握他們,以求達(dá)到在Windows下的開(kāi)發(fā)效率。

去年11月底,當(dāng)時(shí)還沒(méi)有開(kāi)始用Cygwin,就買(mǎi)了一本《Managing Projects with GNU Make》,此時(shí)也算物盡其用了。慢慢開(kāi)始使用variables、macros、phony targets、functions,按步就班的系統(tǒng)學(xué)習(xí)應(yīng)用。

o Ubuntu

磨磨蹭蹭過(guò)了半年,其間因?yàn)槊χ厴I(yè),對(duì)Cygwin和Emacs、GCC、make也算比較熟悉了。

今年10月份,開(kāi)始使用Ubuntu,剛開(kāi)始在Windows下用wubi安裝,很快就直接用新的硬盤(pán)分區(qū)物理安裝,并隨著Ubuntu 9.10的發(fā)布,升級(jí)到了9.10

這前后寫(xiě)Makefile最大的區(qū)別就是,之前純粹是為了寫(xiě)而寫(xiě),之后是為了用而寫(xiě)。

隨著整個(gè)代碼結(jié)構(gòu)的不斷膨脹和修改,Makefile也不斷的變化。

Makefile自身的最大變化是從之前的因?yàn)榫帉?xiě)錯(cuò)誤、通用性差而不斷修改,演變到最后代碼增減不會(huì)影響Makefile,只是為了增加tags、優(yōu)化結(jié)構(gòu)而改動(dòng)。

經(jīng)歷了這個(gè)過(guò)程后,對(duì)于Makefile的結(jié)構(gòu)就比較熟悉了,而且可以從其他使用automake的項(xiàng)目的Makefile中學(xué)習(xí)借鑒了。


之所以想到使用autotools,是因?yàn)榻佑|的很多開(kāi)源項(xiàng)目的代碼都使用了這一組工具。

對(duì)于用戶(hù)而言,一般的項(xiàng)目編譯安裝的過(guò)程:

o bootstrap:檢測(cè)autoconfautomakelibtool及其版本并完成初始化,生成configure;

o configure:檢測(cè)系統(tǒng)平臺(tái)及軟硬件環(huán)境,確定適用本地環(huán)境的編譯策略,生成Makefiles;

o make:編譯、鏈接;

o make install:安裝;

o ldconfig:配置環(huán)境變量。

對(duì)于開(kāi)發(fā)者而言,則需要通過(guò)autoconf、automake為用戶(hù)組織起上面的過(guò)程:

Autoconf 流程
Autoconf 流程

對(duì)于這一流程,我的方法是照葫蘆畫(huà)瓢,參考OGRE等項(xiàng)目的相關(guān)文件和工具的GNU文檔。

寫(xiě)個(gè)Hello, Kitty。

操作的流程和期間出現(xiàn)的幾個(gè)問(wèn)題總結(jié)一下:

o cd project_dir:轉(zhuǎn)到項(xiàng)目目錄;

o emacs Hello.cpp

#include <iostream>

int main(int argc, char** argv)
{
std::cout << "Hello, Kitty!" << std::endl;
return 0;
}

o autoscan:生成configure.scan

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

AC_PREREQ([2.64])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([Hello.cpp])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CXX

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT

o mv configure.scan configure.in:改名;

O emacs configure.in:編輯configure.in

AC_PREREQ([2.64])

# 這個(gè)是自動(dòng)生成的,因?yàn)榇a中沒(méi)有相關(guān)初始化信息,這里手動(dòng)修改一下,非必要
AC_INIT([CgFox], [0.0.1], [http://www.yulefox.com])

# 這個(gè)是必須的,否則無(wú)法生成aclocal.m4
AM_INIT_AUTOMAKE([CgFox], 0.0.1)

AC_CONFIG_SRCDIR([Hello.cpp])

o aclocal:生成aclocal.m4(太長(zhǎng)了,還沒(méi)去仔細(xì)了解)和autom4te.cache;

o autoconf:生成configure(也很長(zhǎng),先不看);

o automake --add-missing。

……


本來(lái)想等明天(今天)弄完了再詳細(xì)整理一下。不過(guò)我沒(méi)有打算把這個(gè)東西搞成一篇教程。記下來(lái)更多的只是為了給自己留下一個(gè)lable,知道自己這幾天在做什么。

最近又是兩點(diǎn)左右睡。腦子里有個(gè)家伙告訴我這樣不好;另一個(gè)家伙告訴我他還不困;還一個(gè)家伙告訴我明天還要上班。

我去你大爺?shù)模?/p>

Feedback

# re: Autotools初體驗(yàn)[未登錄](méi)  回復(fù)  更多評(píng)論   

2009-12-23 08:15 by jacky
autotools用起來(lái)太繁瑣,OGRE已經(jīng)用cmake來(lái)構(gòu)建了,很好用。

# re: Autotools初體驗(yàn)  回復(fù)  更多評(píng)論   

2009-12-23 09:04 by Fox
In practice, CMake not only lacks a rich platform tests suite, compared to autoconf, it also lacks a lot of features from automake and libtool.

So why should you not switch an autotools-based project over to CMake?

Tedious
First and foremost, your configure.ac script may be large. Porting to CMake can be a time consuming and not so funnny task when it comes to the long tail.
iconv support missing
There are no standard tests for iconv(), neither for finding the compiler flags, nor whether it takes a const pointer.
pkg-config support broken
pkg-config support is reportedly broken as of cmake 2.4 patch 8.
Exported symbols list not implemented
There are no documented ways to specify the list of exported symbols for a shared libraries, so your libraries will unconditionnaly expose all their non-static APIs (libtool can use a flat list or a regular expression).
C99 compiler check missing
There is no built-in support to enable C99 support in the C compiler.
Objective-C flags not supported
You can add flags for the Objective-C compiler, but they propagate to C compilation as well.
Compiler feature checks missing
There are no built-in checks for any of the C99 features, such as variable-sized arrays, restricted pointers, macros with variable number of arguments, etc. nor for GCCisms.
Monolithic installation prefix
There is only one global installation prefix. So the typical Linux distro cannot set the global prefix to /usr while the system configuration (automake's sysconfdir) would be /etc. Very nice for "downstream" Linux packagers...
Installation paths hard-coding
As a consequence of the single prefix, you need to hard-code all paths from the prefix. Instead of ${docdir}, you need to hard-code ${prefix}/share/doc/${package} (${CMAKE_INSTALL_PREFIX}/share/doc/foobar in CMake parliance) and so on and so forth. BSD porters are going to have fun tweaking the paths manually...
Uninstallation not supported
There is sipport for uninstalling. That is a design choice. You'd better never ever try to install a package straight from the build tree, without a proper packaging system.
Installation testsuite not supported
Since there is no uninstallation, there is no of course no distcheck target either. How often did you get your source tarball right from the first attempt before a new release?
No cross-compilation
There is no documented support for cross-compilation. This is scheduled for a future release.
Limited documentation
Compared to autotools, the documentation feels a bit light. At least, there is a wiki, but that cannot replace a good offline reference.
Limited executable renaming
CMake is not quite as powerful as automake (with program-prefix, program-suffix and program-transform-name) when it comes to on-the-fly executable renaming. This little-known feature of automake can be extremely useful when building an operating system distribution with possibly conflicting executable names from different projects. For instance, it is very conveniant along with the Debian alternatives system.
No source tarball packaging
There is no built-in support for making a tarball (make dist). Some Version Control Systems can do it themselves (git does, Subversion does not). This is quite critical a feature for open-source projects.
No source tarball testing
As there is no replacement for make dist, there is no replacement for make distcheck either. From my not-so-humble experience, that is tremendously useful before doing a new release. (NOTE: when I write distcheck, I mean distcheck. I don't mean check which becomes test with CMake)
No gettext integration
Gettext is not supported. Targets for .po and .mo files must be added manually. Nevermind that this is the most widely used localization subsystem in the open-source community.
Awkward feature listing
Whereby ./configure --help gives the list of build option, cmake --help prints the CMake options only. Instead, it seems you have to run cmake in "interactive" mode and answer a question for each and every setting (much like Linux kernel make config).
---------------------------
當(dāng)然這些問(wèn)題對(duì)于我不是必需的,不過(guò)還是等我autotools用一段時(shí)間再說(shuō):)

# re: Autotools初體驗(yàn)  回復(fù)  更多評(píng)論   

2009-12-24 10:31 by 飯中淹
這個(gè)相對(duì)于IDE來(lái)說(shuō),有什么優(yōu)勢(shì)?

# re: Autotools初體驗(yàn)  回復(fù)  更多評(píng)論   

2009-12-24 10:52 by Fox
@飯中淹
這套工具現(xiàn)在對(duì)于我更多的是一個(gè)學(xué)習(xí)和試驗(yàn),如果希望和別人交流和共同開(kāi)發(fā)跨平臺(tái)(尤其是non-win)的代碼的話,由于需要對(duì)依賴(lài)庫(kù)進(jìn)行檢測(cè),這個(gè)工作可以由autoconf+automake來(lái)完成。
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲精品一区二区三区婷婷月| 亚洲女爱视频在线| 欧美亚洲日本国产| 日韩天堂在线观看| 一个人看的www久久| 欧美激情一区二区在线| 亚洲精品视频在线播放| 亚洲国产精品专区久久| 91久久精品日日躁夜夜躁欧美| 99精品视频一区二区三区| 亚洲午夜视频在线| 老司机免费视频久久 | 日韩午夜在线电影| 欧美在线观看天堂一区二区三区 | 亚洲精品日日夜夜| 亚洲男人的天堂在线| 久久综合狠狠综合久久综合88| 亚洲精品乱码久久久久久蜜桃麻豆 | 国产精品一区二区三区久久 | 亚洲第一区在线观看| 亚洲中字在线| 99香蕉国产精品偷在线观看| 你懂的视频欧美| 一区二区在线免费观看| 欧美另类变人与禽xxxxx| 狠狠色狠狠色综合日日小说| 亚洲伦理精品| 欧美国产日韩a欧美在线观看| 亚洲欧美日韩精品久久久| 欧美影片第一页| 国产精品欧美日韩久久| 亚洲婷婷在线| 国产精品扒开腿爽爽爽视频| 欧美精品免费在线| 欧美精品日韩一本| 免费成人小视频| 亚洲三级免费| 亚洲精品一区二区三区樱花 | 99在线精品观看| 欧美黄色aa电影| 欧美日韩中国免费专区在线看| **欧美日韩vr在线| 宅男在线国产精品| 久久亚洲精品视频| 欧美激情亚洲精品| 欧美一级日韩一级| 欧美激情黄色片| 性色av香蕉一区二区| 亚洲精品永久免费| 国产精品99久久久久久久vr| 国际精品欧美精品| 一区二区日韩精品| 久久一区亚洲| 国产区欧美区日韩区| 久久se精品一区二区| 免费欧美日韩| 久久久久久999| 欧美日韩国产综合在线| 在线免费精品视频| 久久成人免费视频| 翔田千里一区二区| 亚洲免费av电影| 国内外成人免费视频| 亚洲在线一区| 亚洲一区精品在线| 亚洲欧洲偷拍精品| 久久久不卡网国产精品一区| 亚洲一区二区三区精品动漫| 久久综合一区二区| 国产日韩欧美精品在线| 亚洲社区在线观看| 一本久道久久综合狠狠爱| 欧美激情国产高清| 久久久国产成人精品| 久久婷婷久久| 久久久视频精品| 久久综合电影一区| 亚洲国产一区二区精品专区| 久久久久久综合网天天| 久久久久久久综合狠狠综合| 亚洲天堂男人| 合欧美一区二区三区| 久久一区二区三区av| 亚洲国产91色在线| 欧美视频在线观看 亚洲欧| 亚洲欧美在线另类| 久久免费高清| 亚洲一区二区三区四区五区午夜| 一本色道久久综合亚洲精品婷婷| 亚洲欧美国产精品桃花| 久久一区免费| 国产一区二区日韩| 亚洲国产日韩精品| 欧美亚洲免费在线| 亚洲国产合集| 国产伦精品一区二区三区| 久久久久久**毛片大全| 欧美精品一线| 久久一日本道色综合久久| 亚洲最新在线| 亚洲精品一二三区| 亚洲国产精品va在线观看黑人| 国产精品第一区| 欧美精品久久久久久久| 亚洲黄色在线看| 国产一区清纯| 欧美在线影院| 久久久久欧美| 国产日韩欧美综合精品| 亚洲综合成人婷婷小说| 久久精品首页| 久久久青草婷婷精品综合日韩| 欧美在线电影| 久久亚洲欧美国产精品乐播| 亚洲成人自拍视频| 欧美高潮视频| 亚洲精品日本| 亚洲免费一在线| 久久国产精品电影| 久久久久国产精品一区三寸| 久久婷婷色综合| 欧美理论片在线观看| 国产精品99免视看9| 狠狠色2019综合网| 一本色道久久88亚洲综合88| 亚洲一二三区在线| 久久久久一本一区二区青青蜜月| 欧美gay视频激情| 欧美日韩国产黄| 欧美在线免费视屏| 欧美日韩一区在线视频| 久久视频在线视频| 欧美日韩精品系列| 久久久久久国产精品mv| 亚洲精选成人| 国产欧美一区二区三区视频| 亚洲欧洲免费视频| 久久精品欧美日韩| 国产精品美女一区二区| 欧美激情一区二区久久久| 国产精品一区二区在线观看不卡| 免费黄网站欧美| 久久深夜福利| 香港久久久电影| 一本色道久久综合亚洲精品高清| 在线观看精品一区| 久久亚洲私人国产精品va| 欧美亚洲综合久久| 午夜精品久久久久久久久久久久| 欧美成人精品在线| 欧美不卡一卡二卡免费版| 欧美在线视频二区| 在线观看91精品国产入口| 一区二区三区在线视频播放| 国产精品人人爽人人做我的可爱 | 亚洲一区二区三区乱码aⅴ蜜桃女 亚洲一区二区三区乱码aⅴ | 欧美视频在线视频| 欧美午夜不卡在线观看免费 | 久热精品视频在线观看一区| 欧美一级久久久久久久大片| 国产亚洲欧美一区二区| 国产一区二区三区的电影 | 欧美激情一区二区三区| 久久综合久久综合久久综合| 亚洲国产合集| 一区二区三区四区五区在线| 欧美激情影院| 国产亚洲综合精品| 欧美电影在线观看| 国产区在线观看成人精品| 欧美日韩1区| 国产欧美一区二区三区国产幕精品 | 久久美女性网| 国产精品theporn| 亚洲国产成人不卡| 亚洲视频中文| 欧美日韩在线视频观看| 亚洲高清免费| 国产午夜精品麻豆| 亚洲午夜91| 亚洲一区二区三区四区在线观看| 一区在线观看| 久久九九精品99国产精品| 国产精品国产三级国产普通话三级| 午夜精品一区二区三区电影天堂| 欧美jizzhd精品欧美喷水| 久久亚洲电影| 久久精品免费| 亚洲电影中文字幕| 免费视频久久| 亚洲激情在线观看视频免费| 欧美成人午夜剧场免费观看| 欧美电影免费观看网站| 亚洲国产天堂久久综合| 亚洲自拍16p| 亚洲制服av| 久久精品免视看| 欧美精品入口| 亚洲欧美一区二区原创| 亚洲免费在线|