Linux 中makefile的命令包定義及使用
下面以\build\core\product.mk下面的內容為例介紹:
span style="font-size:14px;">define _find-android-products-files
$(shell test -d device finddevice -maxdepth 6 -name AndroidProducts.mk) \
$(shell test -d vendor find vendor -maxdepth 6 -nameAndroidProducts.mk) \
$(SRC_TARGET_DIR)/product/AndroidProducts.mk
endef/span>
makefile文件中如出現一些相同的命令序列,可為這些相同的序列定義一個變量,不能和makefile文件中的變量重名,這里是_find-Android-products-files,定義這種命令序列的語法以define開始,以endef結束。
命令包的使用,就像使用變量一樣:
span style="font-size:14px;">define get-all-product-makefiles
$(call get-product-makefiles,$(_find-android-products-files))
endef/span>
$(_find-android-products-files),用$來使用命令包,就像使用函數和變量一樣
這里call是函數名,get-product-makefiles和$(_find-android-products-files)是函數的參數
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
您可能感興趣的文章:- linux中無make命令的問題(make: *** 沒有指明目標并且找不到 makefile及make命令安裝方法)
- 一天一個shell命令 linux文本系列-file命令用法
- Linux執行可執行文件提示No such file or directory的解決方法
- Linux下環境變量配置方法小結(.bash_profile和.bashrc的區別)
- Linux中文件描述符fd與文件指針FILE*互相轉換實例解析
- Linux makefile 和shell文件相互調用實例詳解
- Linux file命令的使用