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

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

游戲人生

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

Autotools初體驗

Posted on 2009-12-23 02:18 Fox 閱讀(6954) 評論(5)  編輯 收藏 引用 所屬分類: T技術碎語

本文同步自游戲人生

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


從接觸和使用make以來,前前后后寫了不少Makefile(添添減減、修修補補,累計上千行是有的),今天在重新整理代碼的組織結構之后,突然就想:我為什么不使用Autotools呢?

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

o Cygwin

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

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

去年11月底,當時還沒有開始用Cygwin,就買了一本《Managing Projects with GNU Make》,此時也算物盡其用了。慢慢開始使用variables、macros、phony targets、functions,按步就班的系統學習應用。

o Ubuntu

磨磨蹭蹭過了半年,其間因為忙著畢業,對Cygwin和Emacs、GCC、make也算比較熟悉了。

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

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

隨著整個代碼結構的不斷膨脹和修改,Makefile也不斷的變化。

Makefile自身的最大變化是從之前的因為編寫錯誤、通用性差而不斷修改,演變到最后代碼增減不會影響Makefile,只是為了增加tags、優化結構而改動。

經歷了這個過程后,對于Makefile的結構就比較熟悉了,而且可以從其他使用automake的項目的Makefile中學習借鑒了。


之所以想到使用autotools,是因為接觸的很多開源項目的代碼都使用了這一組工具。

對于用戶而言,一般的項目編譯安裝的過程:

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

o configure:檢測系統平臺及軟硬件環境,確定適用本地環境的編譯策略,生成Makefiles;

o make:編譯、鏈接;

o make install:安裝;

o ldconfig:配置環境變量。

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

Autoconf 流程
Autoconf 流程

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

寫個Hello, Kitty。

操作的流程和期間出現的幾個問題總結一下:

o cd project_dir:轉到項目目錄;

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])

# 這個是自動生成的,因為代碼中沒有相關初始化信息,這里手動修改一下,非必要
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(太長了,還沒去仔細了解)和autom4te.cache;

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

o automake --add-missing。

……


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

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

我去你大爺的!

Feedback

# re: Autotools初體驗[未登錄]  回復  更多評論   

2009-12-23 08:15 by jacky
autotools用起來太繁瑣,OGRE已經用cmake來構建了,很好用。

# re: Autotools初體驗  回復  更多評論   

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

# re: Autotools初體驗  回復  更多評論   

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

# re: Autotools初體驗  回復  更多評論   

2009-12-24 10:52 by Fox
@飯中淹
這套工具現在對于我更多的是一個學習和試驗,如果希望和別人交流和共同開發跨平臺(尤其是non-win)的代碼的話,由于需要對依賴庫進行檢測,這個工作可以由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>
            午夜精品久久久| 亚洲日本成人| 久久婷婷国产综合精品青草| 亚洲欧美在线观看| 欧美亚洲免费在线| 久久99伊人| 久热re这里精品视频在线6| 美乳少妇欧美精品| 欧美日韩第一区| 国产精品久久久久av| 国产美女一区| 伊人春色精品| 99视频日韩| 欧美在线关看| 亚洲福利视频一区| 日韩视频在线一区| 午夜在线成人av| 欧美大片一区二区三区| 国产精品日日做人人爱| 亚洲国产精品va| 香蕉久久夜色精品| 欧美激情精品久久久久久免费印度 | 国产一区二区看久久| 亚洲高清在线精品| 亚洲欧美日韩精品综合在线观看| 久久一区亚洲| 亚洲图片在线观看| 欧美大片免费看| 狠狠噜噜久久| 在线视频欧美日韩| 免费看亚洲片| 午夜精品久久久久久久99樱桃| 米奇777超碰欧美日韩亚洲| 国产精品永久免费| 99热精品在线| 欧美大色视频| 欧美在线91| 国产精品久久久一本精品| 亚洲精品久久久久| 美女主播视频一区| 亚洲欧美国产高清va在线播| 欧美日韩国产精品一卡| 亚洲欧洲日本国产| 开心色5月久久精品| 亚洲欧美国产精品桃花| 欧美日韩一区三区四区| 亚洲美女色禁图| 国产精品成人aaaaa网站| 久久精品国产2020观看福利| 国产精品欧美一区喷水| 一区二区三欧美| 亚洲大胆女人| 久久尤物视频| 欲香欲色天天天综合和网| 久久免费精品视频| 欧美一区二区三区在| 国产日韩在线播放| 久久久久国产精品一区三寸| 香港成人在线视频| 国产日韩精品一区二区三区在线| 午夜在线视频观看日韩17c| 亚洲色图综合久久| 国产精品素人视频| 欧美一级成年大片在线观看| 亚洲一区在线观看视频| 国产欧美日本| 久久乐国产精品| 久久九九久精品国产免费直播| 禁久久精品乱码| 欧美国产日韩一区| 欧美激情二区三区| 亚洲视频在线免费观看| 亚洲一区二区三区免费在线观看| 国产精品色在线| 久久精品日韩| 久久久噜噜噜久久| 亚洲美女黄色片| 亚洲午夜日本在线观看| 国产欧美日韩高清| 久久久亚洲午夜电影| 可以看av的网站久久看| 亚洲精品无人区| 一本色道久久88精品综合| 国产精品国产三级国产专区53 | 欧美日韩亚洲一区| 亚洲欧美日韩在线播放| 欧美在线一区二区三区| 亚洲国产精品一区二区久| 亚洲精品日韩一| 国产精品毛片a∨一区二区三区|国| 欧美伊人久久大香线蕉综合69| 久久精品99| 中文精品99久久国产香蕉| 亚洲欧美中文字幕| 亚洲精品视频一区| 性欧美在线看片a免费观看| 亚洲片在线观看| 午夜国产一区| 99国产精品| 久久精品国产一区二区三区| 一区二区三区高清不卡| 欧美在线免费视屏| 亚洲一区在线观看免费观看电影高清| 久久福利视频导航| 亚洲免费视频观看| 亚洲国产精品一区二区尤物区| 亚洲激情视频网站| 国产视频在线观看一区二区三区 | 欧美一区二区三区在线看| 毛片一区二区三区| 久久精品72免费观看| 欧美日韩亚洲91| 亚洲成色777777女色窝| 国产老肥熟一区二区三区| 亚洲人成亚洲人成在线观看图片| 国外成人在线视频| 亚洲欧美国产视频| 中日韩男男gay无套| 欧美99久久| 久久综合久久综合这里只有精品| 国产精品美女久久久久久2018| 亚洲清纯自拍| 亚洲人精品午夜| 美女在线一区二区| 免费中文日韩| 精品999在线播放| 久久av一区二区三区亚洲| 久久av二区| 国产欧美一区二区精品忘忧草 | 欧美大尺度在线| 狠狠干综合网| 久久国产成人| 欧美一区二区视频在线观看| 国产精品久久久久久久一区探花 | 午夜激情亚洲| 久久激情久久| 国产一区二区成人| 欧美一级成年大片在线观看| 欧美在线视频观看| 国产日韩欧美在线视频观看| 性色一区二区三区| 久久亚洲春色中文字幕久久久| 国产亚洲综合性久久久影院| 欧美一区二视频| 久久综合999| 亚洲黄色有码视频| 欧美日本高清视频| 亚洲精品综合在线| 亚洲视频第一页| 欧美香蕉大胸在线视频观看| 艳女tv在线观看国产一区| 亚洲一区二区三区在线看| 国产精品国产三级国产普通话99 | 亚洲免费在线| 欧美在线免费观看| 国内精品伊人久久久久av一坑| 久久国产精品亚洲va麻豆| 久久蜜桃精品| 亚洲国产精品一区二区久 | 久久久精品网| 欧美国产免费| av不卡在线观看| 一区二区亚洲精品| 国产亚洲欧美另类中文| 久久久久久电影| 亚洲人成在线影院| 午夜亚洲福利| 91久久在线播放| 亚洲一区二区三区乱码aⅴ蜜桃女| 韩国v欧美v日本v亚洲v| 欧美电影免费观看高清| 亚洲欧美日韩一区二区在线 | 国内精品福利| 欧美激情久久久久| 香蕉乱码成人久久天堂爱免费| 欧美二区在线| 亚洲欧美日韩国产成人精品影院| 国产在线观看一区| 欧美日韩国产一区| 久久精品99久久香蕉国产色戒| 亚洲精品欧洲| 麻豆精品网站| 亚洲男女毛片无遮挡| 在线观看日韩欧美| 国产乱子伦一区二区三区国色天香 | 国产精品久久7| 欧美sm重口味系列视频在线观看| 亚洲永久精品国产| 亚洲欧洲一区二区三区| 另类成人小视频在线| 性欧美videos另类喷潮| 艳女tv在线观看国产一区| 亚洲高清视频在线观看| 国产亚洲综合在线| 国产精品色网| 国产精品久久久久久久久久免费| 欧美高清视频在线 | 久久综合色播五月| 久久精品国产69国产精品亚洲 | 国产精品免费看久久久香蕉|