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

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

游戲人生

游戲人生 != ( 人生 == 游戲 )
站點(diǎn)遷移至:http://www.yulefox.com。請訂閱本博的朋友將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 閱讀(6966) 評論(5)  編輯 收藏 引用 所屬分類: T技術(shù)碎語

本文同步自游戲人生

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


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

在開始體驗(yàn)功能強(qiáng)大的Autotools之前,簡單(詳細(xì))回憶總結(jié)一下我使用make的經(jīng)歷和思考的過程,反省一下看看自己在接觸這些新鮮事物的時候到底走了多少彎路。

o Cygwin

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

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

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

o Ubuntu

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

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

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

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

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

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


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

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

o bootstrap:檢測autoconf、automakelibtool及其版本并完成初始化,生成configure;

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

o make:編譯、鏈接;

o make install:安裝;

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

對于開發(fā)者而言,則需要通過autoconf、automake為用戶組織起上面的過程:

Autoconf 流程
Autoconf 流程

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

寫個Hello, Kitty。

操作的流程和期間出現(xià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])

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

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

AC_CONFIG_SRCDIR([Hello.cpp])

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

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

o automake --add-missing。

……


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

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

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

Feedback

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

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

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

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)然這些問題對于我不是必需的,不過還是等我autotools用一段時間再說:)

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

2009-12-24 10:31 by 飯中淹
這個相對于IDE來說,有什么優(yōu)勢?

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

2009-12-24 10:52 by Fox
@飯中淹
這套工具現(xiàn)在對于我更多的是一個學(xué)習(xí)和試驗(yàn),如果希望和別人交流和共同開發(fā)跨平臺(尤其是non-win)的代碼的話,由于需要對依賴庫進(jìn)行檢測,這個工作可以由autoconf+automake來完成。
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲精品综合| 久久er精品视频| 亚洲午夜精品国产| 亚洲欧美在线aaa| 久久精品亚洲一区二区| 久久综合伊人77777蜜臀| 亚洲第一黄色网| 亚洲精品国产拍免费91在线| 亚洲精品综合在线| 性欧美大战久久久久久久久| 久久精品久久99精品久久| 蘑菇福利视频一区播放| 国产精品免费视频观看| 亚洲成人自拍视频| 亚洲欧美精品中文字幕在线| 久久免费偷拍视频| 日韩午夜三级在线| 欧美亚洲综合网| 欧美日韩综合视频| 亚洲欧洲精品一区二区| 欧美一区二区三区免费视| 亚洲国产精品久久久| 羞羞答答国产精品www一本| 欧美精品成人在线| 亚洲国产精品久久久久婷婷884| 欧美一区二区三区在线观看视频| 亚洲欧洲一区二区在线播放| 欧美69wwwcom| 亚洲国产精品国自产拍av秋霞| 久久久久国产精品一区| 亚洲一区二区三区四区视频| 欧美国产精品一区| 亚洲精品日产精品乱码不卡| 欧美 日韩 国产精品免费观看| 亚洲专区一二三| 国产精品美女视频网站| 亚洲欧美日韩国产中文| 亚洲精品一区二区三区不| 欧美日韩ab片| 午夜精品久久久久久久99水蜜桃| 日韩亚洲精品在线| 国产精品欧美久久久久无广告| 亚洲永久视频| 欧美一区2区三区4区公司二百 | 亚洲国产一区在线| 91久久国产综合久久| 欧美日韩中文另类| 欧美有码在线视频| 久久激情视频| 夜久久久久久| 午夜激情综合网| 亚洲精品一线二线三线无人区| 亚洲日本中文字幕| 国产精品日本欧美一区二区三区| 久久久精品国产免大香伊 | 欧美在线高清| 欧美日韩国产精品| 久久激情五月丁香伊人| 麻豆精品在线观看| 午夜精品在线观看| 欧美极品一区二区三区| 欧美一区二区福利在线| 欧美韩日精品| 欧美高清在线播放| 国产三区精品| 99精品视频一区| 99riav国产精品| 免费亚洲电影在线| 久久久亚洲午夜电影| 国产精品美女久久久免费| 亚洲国产欧美一区| 在线播放中文字幕一区| 午夜精品久久久| 欧美在线视频在线播放完整版免费观看 | 最新日韩中文字幕| 亚洲人午夜精品| 欧美激情第8页| 亚洲免费大片| 一区二区三区日韩| 欧美日韩精品免费观看视一区二区 | 一区二区三区 在线观看视| 欧美aⅴ一区二区三区视频| 久热精品视频| 亚洲国产一区二区三区在线播| 久久亚洲不卡| 91久久精品国产91性色tv| 99成人免费视频| 欧美体内谢she精2性欧美| 在线视频一区观看| 欧美在线3区| 樱桃视频在线观看一区| 久久久www成人免费无遮挡大片 | 亚洲欧美激情视频| 国产欧美精品一区aⅴ影院| 欧美一级片一区| 91久久国产综合久久91精品网站| 一区二区三区欧美成人| 国产精品视频精品视频| 久久久久久尹人网香蕉| 亚洲国产网站| 久久久久国内| 夜夜嗨av一区二区三区四区 | 欧美激情一区二区三区不卡| 亚洲天堂av高清| 亚洲国产一区二区精品专区| 亚洲永久字幕| 亚洲精品乱码久久久久久按摩观 | 免费观看在线综合| 欧美一区二区三区在线看| 最新国产拍偷乱拍精品| 美女性感视频久久久| 午夜在线电影亚洲一区| 欧美99在线视频观看| 制服丝袜激情欧洲亚洲| 国产精品亚洲成人| 欧美激情在线免费观看| 久久久亚洲国产天美传媒修理工| 亚洲图片欧美午夜| 亚洲精品欧美激情| 国产精品自拍视频| 欧美午夜欧美| 欧美一级播放| 日韩一级二级三级| 亚洲女同在线| 欧美精品日韩| 在线观看成人av| 亚洲免费在线| 欧美激情一区二区三区在线视频| 亚洲一区二区三区中文字幕| 欧美va亚洲va国产综合| 国产亚洲一区二区三区在线观看| 亚洲国产乱码最新视频| 久久高清免费观看| 亚洲精品影院| 免费国产一区二区| 精品69视频一区二区三区| 先锋资源久久| 在线视频精品| 欧美日韩亚洲高清一区二区| 亚洲精品久久久久久久久久久久| 久久久久久香蕉网| 久久av二区| 国产视频不卡| 久久精品亚洲| 欧美在线观看日本一区| 国产午夜精品视频| 久久精品日产第一区二区| 中日韩午夜理伦电影免费| 欧美性做爰猛烈叫床潮| 亚洲一区视频| 午夜精品久久久久久久99热浪潮| 国产精品成人一区| 欧美在线短视频| 久久久久久亚洲精品杨幂换脸 | 欧美福利影院| 亚洲视频香蕉人妖| 亚洲一区二区免费看| 国产一区二区| 欧美激情一区二区三区四区| 欧美日本不卡| 欧美在线在线| 欧美aⅴ99久久黑人专区| 一本久久综合| 欧美一级在线播放| 亚洲福利免费| 亚洲一区在线观看视频| 18成人免费观看视频| 日韩亚洲不卡在线| 好吊成人免视频| 一本一本久久| 亚洲国产成人tv| 亚洲欧美制服另类日韩| 亚洲激情一区二区| 午夜精品一区二区三区四区| 亚洲精品日本| 久久精品盗摄| 亚洲欧美中文在线视频| 开心色5月久久精品| 亚洲在线播放| 欧美久久精品午夜青青大伊人| 久久精品首页| 国产伦精品一区二区三区在线观看 | 好吊视频一区二区三区四区| 9l国产精品久久久久麻豆| 一区二区三区无毛| 亚洲欧美日本另类| 中文在线资源观看网站视频免费不卡 | 亚洲成色www8888| 欧美在线首页| 久久婷婷久久一区二区三区| 国产日韩三区| 欧美自拍偷拍| 久久婷婷激情| 亚洲国产精品传媒在线观看| 久久精品一二三| 久久综合九色综合网站| 亚洲成人直播| 男人的天堂亚洲| 欧美激情按摩在线| 亚洲国产精品一区制服丝袜 |