【问题标题】:Makefile fails to run properly on WindowsMakefile 无法在 Windows 上正常运行
【发布时间】:2014-09-25 01:10:58
【问题描述】:

我正在尝试运行我的 makefile,但由于某种原因,ma​​ke 甚至无法运行简单的“cls”,我得到的只是:

制作all_w

process_begin: CreateProcess(NULL, cls, ...) 失败。 make (e=2): El sistema no puede encontrar el archivo especificado。 make: * [all_w] 错误 2

这是我的生成文件:

all_l:
    make clean_all_l
    make lexer
    make lexerpiece_l

all_w:  
    cls
    # make clean_all_w
    # make parser
    # make lexer
    # make parserpiece_w

lexerpiece_l:
    gcc lex.yy.c -o lexerpiece_l -lfl -lm
    @echo Done

lexerpiece_w:
    gcc lex.yy.c -o lexerpiece_w -lfl -lm
    @echo Done

parserpiece_w:
    gcc lua_parser.tab.c lex.yy.c -lfl -lm -o parserpiece_w
    @echo Done

clean:  
    $(info Limpiando el Proyecto)
    -del lexerpiece.exe
    -del parserpiece.exe
    @echo Done

clean_all_w:
    $(info Realizando limpieza profunda)
    #cls
    -del lex.yy.c
    #-del lua_parser.tab.c
    #-del lua_parser.tab.h
    #-del lexerpiece_w.exe
    #-del parserpiece_w.exe
    #cls

clean_all_l:
    $(info Realizando limpieza profunda)
    -rm lex.yy.c
    -rm lexerpiece
    clear

#Esto corre FLEX y crea el nuevo lexer
lexer: 
    flex lua_lexer.l
    @echo Lexer creado

#Esto corre BISON y crea el nuevo parser
parser:
    bison -d lua_parser.y
    @echo Parser creado

#Esto correra FLEX sobre un archivo de testing
lexer_test:
    flex test.l
    @echo Lexer de prueba creado

当然,我已经更新了 $PATH 变量。

有什么想法吗?

【问题讨论】:

  • cls 是内置命令,不是可执行文件。 cmd /c cls 可能有用。
  • 如果您不使用 Cygwin,那么此链接可能会对您有所帮助:stackoverflow.com/questions/2463037/…
  • 在 Windows 上使用 make 真的很痛苦。由于您似乎没有使用某些特定的 Windows 东西,我建议您切换并使用一些“严肃”(笑话)操作系统。事情会突然变得容易得多。如果不能,将一些发行版安装到虚拟机中。
  • 你是对的,但是自从我迁移到 14.01 并且图形驱动程序停止工作后,我的 Ubuntu 就坏了……我现在没有时间解决一些 AMD 与 Linux 的问题。有趣的是,我发布的 makefile 曾经可以工作!

标签: windows makefile


【解决方案1】:

我在尝试使用 msys2 时遇到了同样的问题。我已修复将这行代码添加到 makefile:

SHELL=CMD

GNU make manual 中有关此变量的其他信息

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-10
    • 1970-01-01
    • 2018-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多