標籤:autotools makefile gcc
Autotools工具的構成
1、autoscan
autoscan是用來掃描原始碼目錄產生configure.san檔案的,configure.san包含了系統配置的基本選項,裡面都是一些宏定義,我們需要將它的名字改為configure.in
2、aclocal
aclocal是一個perl指令碼程式。aclocal根據configure.in檔案內容自動產生aclocal.m4檔案,產生的aclocal.m4檔案是宏展開檔案。
3、autoconf
autoconf是用來產生configure檔案的,configure.in檔案的內容是一些宏,這些宏經過autoconf處理後會變成檢查系統特性、環境變數、軟體必須的參數的shell指令碼。
4、autohead
自動產生config.h.in
5、automake
使用automake-add-missing來產生Makefile.in.
Document address:https://www.gnu.org/software/autoconf/manual/autoconf.html
Files used in preparing a software package for distribution, when using just Autoconf:
your source files --> [autoscan*] --> [configure.scan] --> configure.ac configure.ac --. | .------> autoconf* -----> configure [aclocal.m4] --+---+ | `-----> [autoheader*] --> [config.h.in] [acsite.m4] ---‘ Makefile.in
Additionally, if you use Automake, the following additional productions come into play:
[acinclude.m4] --. | [local macros] --+--> aclocal* --> aclocal.m4 | configure.ac ----‘ configure.ac --. +--> automake* --> Makefile.in Makefile.am ---‘
Files used in configuring a software package:
.-------------> [config.cache] configure* ------------+-------------> config.log | [config.h.in] -. v .-> [config.h] -. +--> config.status* -+ +--> make* Makefile.in ---‘ `-> Makefile ---‘
Autotools過程示範1、autoscan
修改configure.san檔案名稱為configure.ac或者configure.in,開啟配置我們產生makefile的資訊。
2、aclocal
執行autoconf命令來產生configure可執行檔,並建立一個Makefile.am來編輯內容
bin_PROGRAMS = hellohello_SOURCES = hello.c
安裝軟體
執行make命令和sudo make install
去/usr/local/bin下面執行我們的可執行檔hello
產生壓縮包
Android系統開發(4)——Autotools