问题描述
我试图通过简单执行顶层目录中的make
来构建我的项目.但是,当我这样做时,会出现以下错误:
I'm trying to build my project by simple executing make
in the top directory. However, when I do, I get the following error:
[Errno 2] No such file or directory
[cmd: [u'make']]
[dir: /Users/jonathanong/Workspace/template]
[path: /usr/local/bin]
[Finished]
这是在将构建配置设置为Make
之后.
This is after setting the build configuration to Make
.
我正在使用Sublime Text 2.0.1,OS X 10.8.2.我的Makefile由执行全局安装的node.js
二进制文件组成.我需要做什么?
I'm on Sublime Text 2.0.1, OS X 10.8.2. My Makefile consists of executing globally installed node.js
binaries. What do I have to do?
推荐答案
这是因为make
不在您的PATH中.如果可以在终端中进行构建,请使用which make
找出make
的路径,然后将其添加到构建路径中.您可以编辑 makefile构建系统以添加路径.
This is because make
is not in your PATH. If you can build in the terminal, use which make
to figure out the path to make
, and then add that to the path for build. You can edit the makefile build system to add your path.
您的新makefile规则应如下所示:
Your new makefile rule should look like:
{
"cmd": ["make"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.makefile",
"path": "/usr/local/bin:/Applications/Xcode.app/Contents/Developer/usr/bin",
"variants":
[
{
"name": "Clean",
"cmd": ["make", "clean"]
},
{
"name": "Test",
"cmd": ["make", "test"]
}
]
}
这基本上是默认的make
目标,但是我添加了PATH和(当然)测试目标.您可能必须扩展PATH才能找到gcc,ifort或用于编译的任何东西. 在Linux和Mac上使用:
分隔目录,在Windows上使用;
分隔.您还可以更改其他环境变量,我必须设置DYLD_LIBRARY_PATH和CPATH以便我的库和包含目录可用.
This is basically the default make
target, but I added to the PATH, and (of course) a test target. You may have to extend the PATH to find gcc, ifort, or whatever you are using to compile. Use :
to separate directories on Linux and Mac, and ;
on Windows. You can also change other environment variables, I had to set DYLD_LIBRARY_PATH and CPATH so that my libraries and include directories would be available.
应将其另存为Sublime首选项的User目录中的Make(OSX).sublime-build. (OSX)将确保此文件仅在Mac上使用,因此,当您将首选项复制到非Mac计算机上时,就不会弄乱路径.
It should be saved as Make (OSX).sublime-build in the User directory of your Sublime preferences. The (OSX) will ensure that this file is only used on Mac, so when you copy your preferences to a non-mac computer, you won't gunk up the path.
这篇关于可以“制作"的Sublime Text Build System.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!