C/C++- makefile patsubst 反斜線問題

匿 匿名 754 次瀏覽 0 個回答

Linux Ubuntu

https://imgur.com/0Qbop49可以解釋一下
Backslashes that quote ‘%’ characters or other backslashes are removed from
the pattern before it is compared file names or has a stem substituted into it.

Backslashes that are not in danger of quoting '%' characters go unmolested.

看不懂這兩段話真正的含意,反斜線引用%或其他反斜線會在檔名比較或stem替代之前
移除? stem是什麼??

既然引用其他反斜線的反斜線會被移除,為什麼又說反斜線沒有參與到%的又不會被汙染(不會被移除?


所以結論是 the\%weird\\%pattern\\ -> the%weird\%pattern\\?


新增剛剛的測試
PPP := $(patsubst aasdfBA.c\\\\,aasdfBC.c\\\\, aasdfBA.c\\\\)

PPP 會是aasdfBC.c\\ , A變成C了

但是如果只有PPP := $(patsubst aasdfBA.c\\,aasdfBC.c\\, aasdfBA.c\\\\)
PPP 不變動 還是aasdfBA.c\\ 所以就算沒有在%的前面的反斜線還是會被跳脫啊???

謝謝




--

我要回答

0 個回答

還沒有人回答,你知道答案嗎?

我要回答

登入會員後即可回答問題。

免費註冊