【问题标题】:Windows Sublime Text 3 "make: *** No targets specified and no makefile found. Stop."Windows Sublime Text 3“make:***没有指定目标,也没有找到makefile。停止。”
【发布时间】:2014-10-18 03:33:53
【问题描述】:

很多人显然出于某种原因遇到了这个问题,但我还没有找到任何适用于我的特定案例的已回答问题。如果有一个我错过了,我当然会很感激被指出(以尊重的方式,最好是)。

正如问题所示,我在 Windows 7 x64 机器上使用 Sublime Text 3(稳定通道,Build 3059)。我正在为我的项目使用make 构建系统,因为这是我在工作中在 Mac 上使用的系统,虽然它在 Windows 上不一定最有意义(没有双关语),但它确实应该与适当的设置。我意识到我可以通过不使用make 来规避这个问题,但我更愿意了解问题所在,而不是(或除此之外)只是做其他事情。以下是命令行中的一些信息(即普通的 Windows 命令提示符):

C:\Users\xt\code\d3>where make
C:\cygwin64\bin\make.exe

C:\Users\xt\code\d3>echo %path%
C:\Users\xt\AppData\Roaming\npm;C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Script
s\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\
x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\
WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Sta
tic;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x8
6)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm

请注意,Windows 会在 C:\cygwin64\bin\make.exe 找到 make 命令,而 C:\Cygwin64\bin\ 也在我的 PATH 中。我认为大小写差异不是问题,因为 Sublime Text 并没有抱怨找不到 make,而是抱怨找不到 makefile。

这是我正在使用的目录结构

C:\Users\xt\code\d3>ls -R
.:
Makefile  README.txt  coffee  css  index.html  js  license.txt

./coffee:
index.coffee

./css:
style.css

./js:

请注意,Makefile 实际上存在于d3 目录中。

我在Sublime Text中打开d3目录如下:

  1. 从“开始”菜单打开 Sublime Text
  2. 在 Sublime Text 中,文件 > 打开文件夹... > C:\Users\xt\code\d3
  3. 点击侧边栏中的Makefile

这里是Makefile的内容:

.PHONY: all
all: js/index.js

js/%.js: coffee/%.coffee
    coffee -co $(@D) $<

.PHONY: clean
clean:
    rm -r js

为了记录,每个配方行都以 TAB 字符开头,而不是空格。

查看工具 > 构建系统显示我当前的构建系统是 Automatic。运行 Build 会产生以下输出:

make: *** No targets specified and no makefile found.  Stop.
[Finished in 0.2s with exit code 2]
[shell_cmd: make]
[dir: C:\Users\xt\code\d3]    
[path: C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Scripts\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm]

因此,它正在查找make 命令,并且它从C:\Users\xt\code\d3 目录运行,如前所述,该目录确实包含一个名为Makefile 的makefile。

当我在命令行上尝试同样的事情时,我得到以下信息:

C:\Users\xt\code\d3>make
coffee -co js coffee/index.coffee

...并且,确认成功的结果:

C:\Users\xt\code\d3>ls -R
.:
Makefile  README.txt  coffee  css  index.html  js  license.txt

./coffee:
index.coffee

./css:
style.css

./js:
index.js

我尝试通过创建一个保存为C:\Users\xt\AppData\Roaming\Sublime Text 3\Packages\User\Make (debug).sublime-build 的新构建系统(工具 > 构建系统 > 新构建系统...)来调试 Sublime Text 中的制作过程,其中包含以下内容:

{
    "shell_cmd": "make -dr"
}

当我尝试使用这个新的构建系统Make (debug) 进行构建时,我得到以下结果:

GNU Make 4.0
Built for x86_64-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Updating makefiles....
 Considering target file 'GNUmakefile'.
  File 'GNUmakefile' does not exist.
  Looking for an implicit rule for 'GNUmakefile'.
  No implicit rule found for 'GNUmakefile'.
  Finished prerequisites of target file 'GNUmakefile'.
 Must remake target 'GNUmakefile'.
 Failed to remake target file 'GNUmakefile'.
 Considering target file 'makefile'.
  File 'makefile' does not exist.
  Looking for an implicit rule for 'makefile'.
  No implicit rule found for 'makefile'.
  Finished prerequisites of target file 'makefile'.
 Must remake target 'makefile'.
 Failed to remake target file 'makefile'.
 Considering target file 'Makefile'.
  File 'Makefile' does not exist.
  Looking for an implicit rule for 'Makefile'.
  No implicit rule found for 'Makefile'.
  Finished prerequisites of target file 'Makefile'.
 Must remake target 'Makefile'.
 Failed to remake target file 'Makefile'.
make: *** No targets specified and no makefile found.  Stop.
[Finished in 0.2s with exit code 2]
[shell_cmd: make -dr]
[dir: C:\Users\xt\code\d3]
[path: C:\Cygwin64\bin\;C:\Python27\;C:\Python27\Scripts\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\julia;C:\Users\xt\AppData\Roaming\npm]

不出所料,make 找不到GNUmakefilemakefile,但由于某种原因它也找不到Makefile,尽管它声称在[dir: C:\Users\xt\code\d3] 中运行。为了比较,下面是对应的命令行输出:

C:\Users\xt\code\d3>make -dr
GNU Make 4.0
Built for x86_64-pc-cygwin
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Updating makefiles....
 Considering target file 'Makefile'.
  Looking for an implicit rule for 'Makefile'.
  No implicit rule found for 'Makefile'.
  Finished prerequisites of target file 'Makefile'.
 No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'all'.
 File 'all' does not exist.
  Considering target file 'js/index.js'.
   Looking for an implicit rule for 'js/index.js'.
   Trying pattern rule with stem 'index'.
   Trying implicit prerequisite 'coffee/index.coffee'.
   Found an implicit rule for 'js/index.js'.
    Considering target file 'coffee/index.coffee'.
     Looking for an implicit rule for 'coffee/index.coffee'.
     No implicit rule found for 'coffee/index.coffee'.
     Finished prerequisites of target file 'coffee/index.coffee'.
    No need to remake target 'coffee/index.coffee'.
   Finished prerequisites of target file 'js/index.js'.
   Prerequisite 'coffee/index.coffee' is older than target 'js/index.js'.
  No need to remake target 'js/index.js'.
 Finished prerequisites of target file 'all'.
Must remake target 'all'.
Successfully remade target file 'all'.
make: Nothing to be done for 'all'.

在这里,make 找到 Makefile,就在我们知道的位置。这就是我众所周知的技巧袋的尽头。

所以...感谢所有阅读本文的人,感谢您的反馈。

【问题讨论】:

  • 看起来就像 cygwin 中的一个错误 :(

标签: windows makefile sublimetext3


【解决方案1】:

检查行尾,因为 windows、Linux 和 Mac 使用不同的行尾。

更改view -&gt; Line endings 中的行尾设置尝试使用不同的选项并检查(可能是它的Windows,切换到Mac 并检查一次)。

【讨论】:

    猜你喜欢
    • 2013-01-02
    • 1970-01-01
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 2017-08-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多