Automake
| 開發者 | The GNU Project |
|---|---|
| 穩定版本 | 1.11.1 |
| 作業系統 | Cross-platform |
| 類型 | Programming tool |
| 許可協議 | GNU General Public License |
| 網站 | http://sourceware.org/automake/ |
GNU Automake是一種編程工具,可以產生供make程式使用的Makefile,用來編譯程式。它是自由軟體基金會發起的GNU計劃的其中一項,作為GNU建構系統的一部分。automake所產生的Makefile符合GNU編程標準。
automake是由Perl語言所寫的,必須和GNU autoconf一併使用。automake包含了以下命令:
- aclocal
- automake
aclocal是個泛用的程式,對於autoconf使用者是相當有用的。舉例而言,GNU Compiler Collection使用aclocal,即使Makefile是手寫的。
就像autoconf,automake並非完全向下相容的。舉例而言,使用automake 1.4的專案可能不能使用automake 1.9。
目录 |
方法 [编辑]
Automake目標是讓使用者透過高階語言來寫makefile,而不是透過純手工的方式來寫整個makefile。在簡單的情況下,它能提供:
經由這些資訊,Automake產生makefile能夠讓使用者:
- 編譯程式;
- clean (清除,刪除編譯過程中所產生的檔案);
- 將程式安裝於標準路徑;
- 將程式反安裝(從安裝的地方移除);
- create a source distribution archive (commonly called a tarball);
- test that this archive is self-sufficient, and in particular that the program can be compiled in a directory other than the one where the sources are deployed.
依存性資訊的產生 [编辑]
Automake能夠自動生成依存性的資訊,因此,當一個source文件被修改,下次呼叫make命令的時候就會知道哪些source文件需要重新編譯。如果編譯器允許, Automake會試著讓依存性系統保持動態:無論何時source文件被編譯,都會要求編譯器重新產生依存性列表更新該文件的依存性。換句話說,依存性追蹤是編譯過程的一種邊際效應。
這企圖避免一些靜態依存性系統的問題,比如依存性只會在程式員開始專案時才會被偵測到。在這種情況下,如果源文件獲得一個新的依存性(例如,如果程式員增加了一個新的# include指令在C語言的source文件),這樣在真實的依存性和編譯系統所使用的依存性之間就會產生差異。程式員應該重新產生依存性,但很有可能忘了那樣做。 在一般情況下, automake透過隨附的depcomp腳本生成依存性,這會適當的呼叫編譯器或是回到makedepend。如果gcc編譯器的版本夠新的話,automake將會inline依存性生成碼,直接呼叫gcc。
Libtool [编辑]
Automake 还可用来辅助库的编译,它可以自动生成调用Libtool的Makefile文件,从而使程序员避免了直接调用Libtool, 而项目也可以从此可移植的库生成工具获益。
參見 [编辑]
參考資料 [编辑]
- Gary V. Vaughan, Ben Elliston, Tom Tromey: Gnu Autoconf, Automake, and Libtool, Sams, ISBN 1-57870-190-2
外部鏈結 [编辑]
- Automake home page
- Online version of The Goat Book aka Autobook
- Autotoolset home page
- Article "Using Automake and Autoconf with C++" by Murray Cumming
教材 [编辑]
- Tutorial for beginners "Autotools Tutorial" by Sarah George
- Tutorial "Learning Autoconf and Automake" by Eleftherios Gkioulekas
- The "Autotools Tutorial" by Alexandre Duret-Lutz introduces Autoconf, Automake, Libtool, and Gettext.
- Learning the GNU Development tools
|
|||||||||||||||||||