2015-03-25 63 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