2016-12-02 99 views
1

在makefile中我有一些變量。爲了更好地理解我添加了一些意見:如何在Makefile中註釋一行?

variable1 = value1  #A comment 
variable2 = true  #can be set true or false 
variable3 = foo  #can be foo or bar 

的問題是現在,這兩個變量包含給定文本文本和#之間的所有空間。一個簡單的回聲輸出顯示問題:

echo "$(variable1) $(variable2) endOfEcho" 
value1  true  endOfEcho 

如何避免空格被解釋爲變量的文本?

回答

1

用GNU做:

@echo "$(strip $(variable1)) $(strip $(variable2)) endOfEcho" 
value1 true endOfEcho 

@echo "$(variable1) $(variable2) endOfEcho" 
value1  true  endOfEcho 

@echo $(variable1) $(variable2) endOfEcho 
value1 true endOfEcho 
相關問題