代码为:
# android/device/mediatek/build/core/build_dtboimage.mk
...
my_dtbo_id := 0
define mk_dtboimg_cfg
$(eval name := $$(basename $1))
echo "file name:$(name)";
$(eval dts_file_name := $(notdir $(name)))
echo "terminal_name:$$(echo $(dts_file_name) | awk -F '_' '{print $$1}')";
$(eval terminal_name := $$(echo $(dts_file_name) | awk -F '_' '{print $$1}'))
$(eval main_name := $$(echo $(dts_file_name) | awk -F '_' '{print $$3}'))
echo "terminal_name :$(terminal_name), main_name :$(main_name )";
...
,输出为:
file name:out/target/product/k62v1_64_pax/obj/KERNEL_OBJ/arch/arm64/boot/dts/mediatek/A3700_MT6762_V02_V01
terminal_name:A3700
terminal_name:, main_name:
如上图所示,代码echo "terminal_name:$$(echo $(dts_file_name) | awk -F '_' '{print $$1}')";
可以得到A3700的正确输出,但是我不知道为什么terminal_name和main_name的输出是null.我期望的正确输出是terminal_name:A3700, main_name:V02,换句话说,我希望terminal_name和main_name
我该怎么做才能解决这个问题?
谢谢!
你把事情弄得太复杂了。
删除不必要的功能,并慷慨地使用$
:
...
dts_file_name := $$(notdir $$(name))
terminal_name := $$(shell echo $$(dts_file_name) | awk -F '_' '{print $$$$1}')
main_name := $$(shell echo $$(dts_file_name) | awk -F '_' '{print $$$$3}')
$$(info terminal: $$(terminal_name), main: $$(main_name))
...