Linux 中makefile的命令包定義及使用
下面以/build/core/product.mk下面的內(nèi)容為例介紹:
<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文件中如出現(xiàn)一些相同的命令序列,可為這些相同的序列定義一個(gè)變量,不能和makefile文件中的變量重名,這里是_find-Android-products-files,定義這種命令序列的語法以define開始,以endef結(jié)束。
命令包的使用,就像使用變量一樣:
<span style="font-size:14px;">define get-all-product-makefiles $(call get-product-makefiles,$(_find-android-products-files)) endef</span>
$(_find-android-products-files),用$來使用命令包,就像使用函數(shù)和變量一樣
這里call是函數(shù)名,get-product-makefiles和$(_find-android-products-files)是函數(shù)的參數(shù)
感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!
新聞熱點(diǎn)
疑難解答
圖片精選