2015-03-25 64 views
-1

我是新來的makefile stuff.I想運行一個for循環,但我陷入了一個錯誤。代碼和錯誤在下面給出。makefile中的forloop問題

LIST = one two three 
qwert: 
    for number in $(LIST) ; do \ 
     echo $$number ; \ 
    done 

錯誤:

number was unexpected this time 
make: ***[qwert] Error 255 

問題是什麼,如何解決這個問題???

+0

錯誤消息看起來像'cmd.exe'。你的代碼很好,只需使用正確的shell。 – tripleee 2015-03-25 06:24:59

+0

@tripleee:我不明白..正確的殼意味着 – Vineeth 2015-03-25 06:27:20

+0

Bash,可能。一個普通的'make'應該運行'sh',即使它不是你的首選shell,所以這部分顯然是錯誤的。但是你對平臺或Make版本的瞭解很少,所以這一定是相當投機的。 – tripleee 2015-03-25 06:31:08

回答

0

你有沒有試着用一個簡單的makefile定義shell(由tripleee的建議):

SHELL = /bin/sh 

LIST = one two three 

qwert: 
    @for number in $(LIST) ; do \ 
    echo $$number ; \ 
    done 
+0

如果你的系統上有'/ bin/sh',那就不需要了。我猜測它會回到'cmd'作爲CygWin上的最後一次recort。 – tripleee 2015-03-26 16:09:09