Makefile Comments 注釋在 makefile 中起著重要的作用,它幫助我們更快更好的理解 makefile 的內(nèi)容。 # 注釋符 # 字符是注釋符,makefile 把 # 字符后面的內(nèi)容作為注釋內(nèi)容處理(shell、perl 腳本也是使用 # 字符作為注釋符)。如果某行的第一個非空字符為 #,則此行會被 make 解釋為注釋行(命令行除外,如果 Tab 字符之后使用 # 字符,則會被 make 解釋為命令行)。 注釋行的結(jié)尾如果存在反斜線(\),那么下一行也被作為注釋行。 如果需要注視多行,在注釋行的結(jié)尾加行反斜線(\),下一行也被注釋,可以注釋多行。 建議在書寫 makefile 時將注釋作為一個獨立的行,而不要和 makefile 的有效行放在同一行中書寫。make 有時候會把 # 字符之前的內(nèi)容作為有效行的內(nèi)容(如定義變量的時候)。 當在 makefile 中需要使用字符 # 時,可以使用 \ 加 #(\#)來實現(xiàn),表示將 # 字符作為一個普通字符而不是注釋符。 示例 1 Makefile 文件的內(nèi)容如下 # this makefile \ for test comments makefile_version = 3.82 # there has two spaces before # comments = "the \# character as the comment contents!" print : echo $(comments) printf "make $(makefile_version) welcome! \n" 在命令提示符下輸入 “make -s”,執(zhí)行結(jié)果如下: the # character as the comment contents! make 3.82 welcome!
|
|
來自: Kinetis > 《makefile》