由于某种原因,很多人显然遇到了这个问题,但我还没有找到适用于我的具体案例的任何已回答的问题。如果那里有一个我错过的,我一定会感激被指出(以尊重的方式,最好)。
如问题所示,我在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在make
处找到C:\cygwin64\bin\make.exe
命令,而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
目录,如下所示:
Makefile
以下是Makefile
的内容:
.PHONY: all
all: js/index.js
js/%.js: coffee/%.coffee
coffee -co $(@D) $<
.PHONY: clean
clean:
rm -r js
对于记录,每个食谱行以TAB
字符开头,而不是空格。
查看工具&gt; Build Systems显示我当前的Build System是Automatic
。 Running 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
的新构建系统(工具&gt;构建系统&gt;新构建系统...)来调试Sublime Text中的make过程,其中包含以下内容:
{
"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
无法找到GNUmakefile
或makefile
,但由于某种原因它无法找到Makefile
,尽管声称自己在{{}}中运行1}}。为了比较,这是相应的命令行输出:
[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
,就在我们知道的地方。而那就是我达到诀窍的最终结果。
所以...感谢所有打扰阅读这一切的人,感谢您的反馈。
答案 0 :(得分:1)
检查行结尾,因为Windows,Linux和Mac使用不同的行结尾。
使用不同选项更改view -> Line endings
尝试中的行结束设置并检查(可能是Windows,切换到Mac并检查一次)。