<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>

新聞中心

EEPW首頁(yè) > 嵌入式系統 > 設計應用 > 自動(dòng)生成 Makefile 的全過(guò)程詳解

自動(dòng)生成 Makefile 的全過(guò)程詳解

作者: 時(shí)間:2016-10-10 來(lái)源:網(wǎng)絡(luò ) 收藏

bin_PROGRAMS

這個(gè)是指定我們所要產(chǎn)生的可執行文件的文件名。如果你要產(chǎn)生多個(gè)可執行文件,那么在各個(gè)名字間用空格隔開(kāi)。

helloworld_SOURCES

這個(gè)是指定產(chǎn)生“helloworld” 時(shí)所需要的源代碼。如果它用到了多個(gè)源文件,那么請使用空格符號將它們隔開(kāi)。比如需要 helloworld.h ,helloworld.c 那么請寫(xiě)成helloworld_SOURCES= helloworld.h helloworld.c 。

如果你在bin_PROGRAMS 定義了多個(gè)可執行文件,則對應每個(gè)可執行文件都要定義相對的filename_SOURCES 。

6 、 automake

我們使用automake --add-missing 來(lái)產(chǎn)生Makefile.in 。

選項--add-missing 的定義是“add missing standard files to package” ,它會(huì )讓automake 加入一個(gè)標準的軟件包所必須的一些文件。

我們用automake 產(chǎn)生出來(lái)的Makefile.in 文件是符合GNU Makefile 慣例的,接下來(lái)我們只要執行configure 這個(gè)shell腳本就可以產(chǎn)生合適的 Makefile 文件了。

7 、 Makefile

在符合GNU Makefiel 慣例的Makefile 中,包含了一些基本的預先定義的操作:

make

根據Makefile 編譯源代碼,連接,生成目標文件,可執行文件。

make clean

清除上次的make 命令所產(chǎn)生的object 文件(后綴為“.o” 的文件)及可執行文件。

make install

將編譯成功的可執行文件安裝到系統目錄中,一般為/usr/local/bin 目錄。

make dist

產(chǎn)生發(fā)布軟件包文件(即distribution package )。這個(gè)命令將會(huì )將可執行文件及相關(guān)文件打包成一個(gè)tar.gz 壓縮的文件用來(lái)作為發(fā)布軟件的軟件包。

它會(huì )在當前目錄下生成一個(gè)名字類(lèi)似“PACKAGE-VERSION.tar.gz” 的文件。PACKAGE 和VERSION ,是我們在configure.in 中定義的AM_INIT_AUTOMAKE(PACKAGE, VERSION) 。

make distcheck

生成發(fā)布軟件包并對其進(jìn)行測試檢查,以確定發(fā)布包的正確性。這個(gè)操作將自動(dòng)把壓縮包文件解開(kāi),然后執行configure 命令,并且執行make ,來(lái)確認編譯不出現錯誤,最后提示你軟件包已經(jīng)準備好,可以發(fā)布了。

===============================================

helloworld-1.0.tar.gz is ready for distribution

===============================================

make distclean

類(lèi)似make clean ,但同時(shí)也將configure 生成的文件全部刪除掉,包括Makefile 。

五、結束語(yǔ)

通過(guò)上面的介紹,你應該可以很容易地生成一個(gè)你自己的符合GNU 慣例的Makefile 文件及對應的項目文件。

如果你想寫(xiě)出更復雜的且符合慣例的Makefile ,你可以參考一些開(kāi)放代碼的項目中的configure.in 和Makefile.am 文件,比如:嵌入式數據庫sqlite ,單元測試cppunit 。


上一頁(yè) 1 2 3 下一頁(yè)

關(guān)鍵詞: linux

評論


相關(guān)推薦

技術(shù)專(zhuān)區

關(guān)閉
国产精品自在自线亚洲|国产精品无圣光一区二区|国产日产欧洲无码视频|久久久一本精品99久久K精品66|欧美人与动牲交片免费播放
<dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><small id="yhprb"></small><dfn id="yhprb"></dfn><small id="yhprb"><delect id="yhprb"></delect></small><small id="yhprb"></small><small id="yhprb"></small> <delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"></dfn><dfn id="yhprb"></dfn><s id="yhprb"><noframes id="yhprb"><small id="yhprb"><dfn id="yhprb"></dfn></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><small id="yhprb"></small><dfn id="yhprb"><delect id="yhprb"></delect></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn> <small id="yhprb"></small><delect id="yhprb"><strike id="yhprb"></strike></delect><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn><dfn id="yhprb"><s id="yhprb"><strike id="yhprb"></strike></s></dfn><dfn id="yhprb"><s id="yhprb"></s></dfn>