久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

深入淺出學Makefile<二:如何自動生成Makefile>

 敗敗0619 2012-08-24
(第二部分:龐大的makefile是怎么生成的 )

四:自動生成makefile

4.1 以helloworld.c為源文件

root@parson-desktop:/home/parson/tmp/automk# ls

hellolinux.c

4.2.使用Autoscan工具生成configure.ac文件

root@parson-desktop:/home/parson/tmp/automk# autoscan

程序“autoscan”尚未安裝,。  您可以使用以下命令安裝:

apt-get install autoconf

安裝autoconf,輸入如下命令

root@parson-desktop:/home/parson/tmp/automk# apt-get install autoconf

正在讀取軟件包列表... 完成

正在分析軟件包的依賴關系樹      

正在讀取狀態(tài)信息... 完成      

將會安裝下列額外的軟件包:

  automake autotools-dev

建議安裝的軟件包:

  autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool gettext

下列【新】軟件包將被安裝:

  autoconf automake autotools-dev

升級了 0 個軟件包,新安裝了 3 個軟件包,,要卸載 0 個軟件包,,有 273 個軟件包未被升級,。

需要下載 1,444kB 的軟件包,。

解壓縮后會消耗掉 4,325kB 的額外空間。

您希望繼續(xù)執(zhí)行嗎,?[Y/n]y

獲?。? http://ftp./ubuntu/ lucid/main autoconf 2.65-3ubuntu1 [772kB]

獲取:2 http://ftp./ubuntu/ lucid/main autotools-dev 20090611.1 [64.1kB]                               

獲?。? http://ftp./ubuntu/ lucid/main automake 1:1.11.1-1 [608kB]                                     

下載 1,444kB,,耗時 2分 59秒 (8,044B/s)                                                                             

選中了曾被取消選擇的軟件包 autoconf。

(正在讀取數據庫 ... 系統(tǒng)當前總共安裝有 149752 個文件和目錄,。)

正在解壓縮 autoconf (從 .../autoconf_2.65-3ubuntu1_all.deb) ...

選中了曾被取消選擇的軟件包 autotools-dev,。

正在解壓縮 autotools-dev (從 .../autotools-dev_20090611.1_all.deb) ...

選中了曾被取消選擇的軟件包 automake。

正在解壓縮 automake (從 .../automake_1%3a1.11.1-1_all.deb) ...

正在處理用于 man-db 的觸發(fā)器...

正在處理用于 doc-base 的觸發(fā)器...

Processing 39 changed 1 added doc-base file(s)...

Registering documents with scrollkeeper...

正在處理用于 install-info 的觸發(fā)器...

正在設置 autoconf (2.65-3ubuntu1) ...

正在設置 autotools-dev (20090611.1) ...

正在設置 automake (1:1.11.1-1) ...

update-alternatives: 使用 /usr/bin/automake-1.11 來提供 /usr/bin/automake (automake),,于 自動模式 中,。

root@parson-desktop:/home/parson/tmp/automk# ls

hellolinux.c

再一次執(zhí)行autoscan

root@parson-desktop:/home/parson/tmp/automk# autoscan

root@parson-desktop:/home/parson/tmp/automk# ls

autoscan.log  configure.scan  hellolinux.c

生成了autoscan.log和configure.scan

我們看看生成了兩個文件是什么東西

root@parson-desktop:/home/parson/tmp/automk# cat autoscan.log

autoscan.log沒有內容

root@parson-desktop:/home/parson/tmp/automk# cat configure.scan

#                                               -*- Autoconf -*-

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

AC_PREREQ([2.65])

AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])

AC_CONFIG_SRCDIR([helloworld.c])

AC_CONFIG_HEADERS([config.h]) 

# Checks for programs.

AC_PROG_CC

# Checks for libraries.

# Checks for header files. 

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT

(1)AC_PREREQ宏聲明本文件要求的autoconf版本,本例使用的版本為2.65,。

(2)AC_INIT宏用來定義軟件的名稱和版本等信息,,”FULL-PACKAGE-NAME”為軟件包名稱,”VERSION”為軟件版本號,,”BUG-REPORT-ADDRESS”為BUG報告地址(一般為軟件作者郵件地址),。

(3)AC_CONFIG_SRCDIR宏用來偵測所指定的源碼文件是否存在,來確定源碼目錄的有效性,。此處為當前目錄下的helloworld.c,。

(4)AC_CONFIG_HEADER宏用于生成config.h文件,以便autoheader使用,。

(5)AC_PROG_CC用來指定編譯器,,如果不指定,,選用默認gcc,。

(6)AC_OUTPUT用來設定 configure 所要產生的文件,,如果是makefile,configure會把它檢查出來的結果帶入makefile.in文件產生合適的makefile,。使用 Automake時,,還需要一些其他的參數,這些額外的宏用aclocal工具產生,。

root@parson-desktop:/home/parson/tmp/automk# mv configure.scan configure.ac

root@parson-desktop:/home/parson/tmp/automk# vim configure.ac

#                                               -*- Autoconf -*-

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

AC_PREREQ([2.65])

AC_INIT(hellolinux,1.0,[email protected])

AM_INIT_AUTOMAKE(hellolinux,1.0)

AC_CONFIG_SRCDIR([hellolinux.c])

#AC_CONFIG_HEADERS([config.h]) 

# Checks for programs.

AC_PROG_CC 

# Checks for libraries. 

# Checks for header files. 

# Checks for typedefs, structures, and compiler characteristics. 

# Checks for library functions. 

AC_OUTPUT(Makefile)~

"configure.ac" 21L, 498C 已寫入                                                            

root@parson-desktop:/home/parson/tmp/automk# ls

autoscan.log  configure.ac  hellolinux.c

4.3 利用aclocal工具制作aclocal.m4文件

root@parson-desktop:/home/parson/tmp/automk# aclocal

root@parson-desktop:/home/parson/tmp/automk# ls

aclocal.m4  autom4te.cache  autoscan.log  configure.ac  hellolinux.c

4.4 利用autoconf制作configure工具

root@parson-desktop:/home/parson/tmp/automk# autoconf

root@parson-desktop:/home/parson/tmp/automk# ls

aclocal.m4  autom4te.cache  autoscan.log  configure  configure.ac  hellolinux.c

4.5編寫Makefile.am文件

root@parson-desktop:/home/parson/tmp/automk# vim Makefile.am 

AUTOMAKE_OPTIONS=foreign

bin_PROGRAMS=hellolinux

hellolinux_SOURCES=hellolinux.c~

"Makefile.am" [新] 3L, 81C 已寫入       

4.6 通過automake產生Makefile.in文件                                                  

root@parson-desktop:/home/parson/tmp/automk# ./configure

configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."

root@parson-desktop:/home/parson/tmp/automk# automake --add-missing

configure.ac:6: installing `./install-sh'

configure.ac:6: installing `./missing'

Makefile.am: installing `./depcomp'

root@parson-desktop:/home/parson/tmp/automk# ls

aclocal.m4      autoscan.log  configure     depcomp       install-sh   Makefile.in

autom4te.cache  config.log    configure.ac  hellolinux.c  Makefile.am  missing

4.7 通過運行./configure產生Makefile文件

root@parson-desktop:/home/parson/tmp/automk# ./configure

checking for a BSD-compatible install... /usr/bin/install -c

checking whether build environment is sane... yes

checking for a thread-safe mkdir -p... /bin/mkdir -p

checking for gawk... gawk

checking whether make sets $(MAKE)... yes

checking for gcc... gcc

checking whether the C compiler works... yes

checking for C compiler default output file name... a.out

checking for suffix of executables...

checking whether we are cross compiling... no

checking for suffix of object files... o

checking whether we are using the GNU C compiler... yes

checking whether gcc accepts -g... yes

checking for gcc option to accept ISO C89... none needed

checking for style of include used by make... GNU

checking dependency style of gcc... gcc3

configure: creating ./config.status

config.status: creating Makefile

config.status: executing depfiles commands

root@parson-desktop:/home/parson/tmp/automk# ls

aclocal.m4      autoscan.log  config.status  configure.ac  hellolinux.c  Makefile     Makefile.in

autom4te.cache  config.log    configure      depcomp       install-sh    Makefile.am  missing 

    本站是提供個人知識管理的網絡存儲空間,,所有內容均由用戶發(fā)布,不代表本站觀點,。請注意甄別內容中的聯系方式,、誘導購買等信息,謹防詐騙,。如發(fā)現有害或侵權內容,,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多