中文字幕 另类精品,亚洲欧美一区二区蜜桃,日本在线精品视频免费,孩交精品乱子片免费

<sup id="3hn2b"></sup>

    1. <sub id="3hn2b"><ol id="3hn2b"></ol></sub><legend id="3hn2b"></legend>

      1. <xmp id="3hn2b"></xmp>

      2. 新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > Linux下C編程基礎(chǔ)之:使用autotools

        Linux下C編程基礎(chǔ)之:使用autotools

        作者: 時間:2013-09-13 來源:網(wǎng)絡(luò) 收藏

        本文引用地址:http://www.antipu.com.cn/article/257148.htm

        下面對該腳本文件的對應(yīng)項進行解釋。

        n 其中的AUTOMAKE_OPTIONS為設(shè)置automake的選項。GNU對自己發(fā)布的軟件有嚴(yán)格的規(guī)范,比如必須附帶許可證聲明文件COPYING等,否則automake執(zhí)行時會報錯。automake提供了3種軟件等級:foreign、gnu和gnits,讓用戶選擇采用,默認(rèn)等級為gnu。在本示例中采用foreign等級,它只檢測必須的文件。

        n bin_PROGRAMS定義要產(chǎn)生的執(zhí)行文件名。如果要產(chǎn)生多個執(zhí)行文件,每個文件名用空格隔開。

        n hello_SOURCES定義“hello”這個執(zhí)行程序所需要的原始文件。如果“hello”這個程序是由多個原始文件所產(chǎn)生的,則必須把它所用到的所有原始文件都列出來,并用空格隔開。例如:若目標(biāo)體“hello”需要“hello.c”、“david.c”、“hello.h”三個依賴文件,則定義hello_SOURCES=hello.cdavid.chello.h。要注意的是,如果要定義多個執(zhí)行文件,則對每個執(zhí)行程序都要定義相應(yīng)的file_SOURCES。

        接下來可以使用automake命令來生成“configure.in”文件,在這里使用選項“-a”(或者“—adding-missing”)可以讓automake自動添加一些必需的腳本文件。如下所示:

        [root@localhostautomake]#automake–a(或者automake--add-missing)

        configure.in:installing'./install-sh'

        configure.in:installing'./missing'

        makefile.am:installing'depcomp'

        [root@localhostautomake]#ls

        aclocal.m4autoscan.logconfigure.inhello.cmakefile.ammissing

        autom4te.cacheconfiguredepcompinstall-shmakefile.inconfig.h.in

        可以看到,在automake之后就可以生成configure.in文件。

        5.運行configure

        在這一步中,通過運行自動配置設(shè)置文件configure,把makefile.in變成了最終的makefile。如下所示:

        [root@localhostautomake]#./configure

        checkingforaBSD-compatibleinstall.../usr/bin/install-c

        checkingwhetherbuildenvironmentissane...yes

        checkingforgawk...gawk

        checkingwhethermakesets$(MAKE)...yes

        checkingforgcc...gcc

        checkingforCcompilerdefaultoutputfilename...a.out

        checkingwhethertheCcompilerworks...yes

        checkingwhetherwearecrosscompiling...no

        checkingforsuffixofexecutables...

        checkingforsuffixofobjectfiles...o

        checkingwhetherweareusingtheGNUCcompiler...yes

        checkingwhethergccaccepts-g...yes

        checkingforgccoptiontoacceptANSIC...noneneeded

        checkingforstyleofincludeusedbymake...GNU

        checkingdependencystyleofgcc...gcc3

        configure:creating./config.status

        config.status:creatingmakefile

        config.status:executingdepfilescommands

        可以看到,在運行configure時收集了系統(tǒng)的信息,用戶可以在configure命令中對其進行方便的配置。在./configure的自定義參數(shù)有兩種,一種是開關(guān)式(--enable-XXX或--disable-XXX),另一種是開放式,即后面要填入一串字符(--with-XXX=yyyy)參數(shù)。讀者可以自行嘗試其使用方法。另外,讀者可以查看同一目錄下的“config.log”文件,以方便調(diào)試之用。

        到此為止,makefile就可以自動生成了?;貞浾麄€步驟,用戶不再需要定制不同的規(guī)則,而只需要輸入簡單的文件及目錄名即可,這樣就大大方便了用戶的使用。生成makefile的流程如圖3.9所示。

        圖3.9生成makefile的流程圖

        linux操作系統(tǒng)文章專題:linux操作系統(tǒng)詳解(linux不再難懂)


        評論


        相關(guān)推薦

        技術(shù)專區(qū)

        關(guān)閉