由于某种原因,很多人显然遇到了这个问题,但是我还没有find适用于我的具体情况的任何回答的问题。 如果有一个我错过了,我当然会赞赏被指出来(最好是以一种有礼貌的方式)。
正如问题所示,我在Windows 7 x64机器上使用Sublime Text 3(稳定频道,Build 3059)。 我正在为我的项目使用make
build系统,因为这是我在工作时使用的Mac上的,尽pipe它不一定在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
findmake
命令, C:\cygwin64\bin\make.exe
也在我的PATH中。 崇高的文字不是抱怨找不到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
为了logging,每个食谱行以TAB
字符开始,而不是空格。
看看工具>构build系统显示我目前的构build系统是Automatic
。 运行生成产生以下输出:
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]
所以,它find了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
我试着通过创build一个保存为C:\Users\xt\AppData\Roaming\Sublime Text 3\Packages\User\Make (debug).sublime-build
的新的构build系统(Tools> Build System> New Build System …)来debuggingSublime Text中的make过程C:\Users\xt\AppData\Roaming\Sublime Text 3\Packages\User\Make (debug).sublime-build
与以下内容:
{ "shell_cmd": "make -dr" }
当我尝试构build使用这个新的生成系统, 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
不能findGNUmakefile
或者makefile
,但是由于某种原因,尽pipe声称在[dir: C:\Users\xt\code\d3]
运行,也找不到Makefile
。 为了比较,下面是相应的命令行输出:
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
findMakefile
,就在我们知道的地方。 而这正是我所滔滔不绝的诀窍的结束。
所以…感谢任何一个懒得读这些东西的人,我感谢你的反馈。
检查线结束,因为Windows,Linux和Mac使用不同的行尾。
在view -> Line endings
更改行结束设置view -> Line endings
尝试不同的选项,并检查(可能是其Windows,切换到Mac,并检查一次)。