为什么我不能在Windows上的makefile中使用?

mi2*_*ink -1 for-loop makefile

我曾多次尝试,但make告诉我n不应该在那里.

我的简单makefile:

all:
    for n in $(ALL_FILES); do\
        echo $$n; \
    done
Run Code Online (Sandbox Code Playgroud)

错误输出:

n 不应该在那里.

更新:

感谢你们!当我在linux中运行它时,没关系.我发现Windows不支持for-syntax!

enr*_*cis 5

您应该考虑foreach函数,但您也可以使用for,确保您的for循环将在Makefile之外运行(特别是检查$(ALL_FILES)可迭代的格式):

Makefile文件

all:
    @for n in $(shell seq 1 5); do\
        echo $$n; \
    done
Run Code Online (Sandbox Code Playgroud)

$ make
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud)