makefile中使用萬用字元和分行符號__makefile

來源:互聯網
上載者:User

介紹 makefile 規則的其它寫法,如在命令中使用萬用字元,和把命令與依賴寫在同一行,以及分行符號的使用。看例子 test006,除了 makefile 檔案不一樣,test006 與 test005 的其它檔案是一樣的。

 

#執行方式:
#make -f test006.mk
#################################################################
#說明:
#1.介紹 makefile 規則的其它寫法
#################################################################
#不能把 OBJ 改為 *.o
OBJ = math.o main.o
#命令與依賴關係在同一行,中間用 [;] 隔開
test.exe : $(OBJ);cc -o test.exe $(OBJ)

math.o : math.h common.h
#[/]是分行符號的意思,makefile 對同一行有多少個字元沒有限制
main.o : main.h math.h /
common.h

#用 PHONY 顯示說明 clean 是一個偽目標
.PHONY : clean
clean:
#在命令中使用萬用字元
 -rm test.exe *.o

 

 請從 http://u.115.com/file/f47a68b727 下載這個例子

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.