简体   繁体   English

阻止makefile中的变量扩展

[英]preventing variable expansion in makefile

I want to write this into a file: 我想把它写成一个文件:

-MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"

but when I echo this into a file, with "" , or '' , the variables will expand, how can I prevent the expansion and write it as is? 但是当我赞同这个到一个文件,与""'' ,变量将扩大,我怎么能防止膨胀,并把它写成是什么?

PS echo '-MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"' is called in a makefile. PS echo '-MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"'在makefile中调用。

in my makefile, I let's say I have: 在我的makefile中,我想说我有:

all:
    echo '-MF"$(@:%.o=%.d)" -MT"$(@)" -o "$@" "$<"' > $file

what I see in the file is 我在文件中看到的是

-MF"all" -MT"all" -o "all" "" -MF“all”-MT“all”-o“all”“”

Use $$ to put a dollar sign into a Makefile recipe 使用$$将美元符号放入Makefile配方中

all:
    echo '-MF"$$(@:%.o=%.d)" -MT"$$(@)" -o "$$@" "$$<"' > $file

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM