claveren
claveren

Reputation: 41

Windows Sublime Text 3 "make: *** No targets specified and no makefile found. Stop."

Tons of people have apparently run into this issue for one reason or another, but I have yet to find any answered questions that apply to my particular case. If there's one out there that I missed, I will certainly appreciate being pointed to it (in a respectful manner, preferably).

As the question indicates, I'm using Sublime Text 3 (Stable channel, Build 3059) on a Windows 7 x64 machine. I'm using the make build system for my project because that's what I use on my Mac at work and, while it doesn't necessarily make the most sense on Windows (no pun intended), it really should work with the proper setup. I realize that I could circumvent this issue by not using make, but I'd prefer to understand what the problem is rather than (or in addition to) just doing something else. Here's some info from the command line (i.e. the plain vanilla Windows Command Prompt):

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

Note that Windows finds the make command at C:\cygwin64\bin\make.exe and C:\Cygwin64\bin\ is also in my PATH. I don't think the capitalization difference is the issue since Sublime Text isn't complaining about being unable to find make, but about not finding a makefile.

Here is the directory structure I'm using

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

./coffee:
index.coffee

./css:
style.css

./js:

Note that Makefile does in fact exist in the d3 directory.

I open the d3 directory in Sublime Text as follows:

  1. Open Sublime Text from the Start menu
  2. In Sublime Text, File > Open Folder... > C:\Users\xt\code\d3
  3. Click Makefile in the Sidebar

Here are the contents of Makefile:

.PHONY: all
all: js/index.js

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

.PHONY: clean
clean:
    rm -r js

For the record, each recipe line starts with a TAB character, not spaces.

Looking at Tools > Build Systems shows that my current Build System is Automatic. Running Build produces the following output:

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]

So, it's finding the make command, and it's running from the C:\Users\xt\code\d3 directory which, as noted before, does contain a makefile called Makefile.

When I try the same thing on the command line, I get the following:

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

... and, to confirm the successful results:

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

I tried debugging the make process in Sublime Text by creating a new Build System (Tools > Build System > New Build System...) saved as C:\Users\xt\AppData\Roaming\Sublime Text 3\Packages\User\Make (debug).sublime-build with the following content:

{
    "shell_cmd": "make -dr"
}

When I try to build using this new Build System, Make (debug), I get the following results:

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]

Unsurprisingly, make can't find GNUmakefile or makefile, but for some reason it can't find Makefile either, despite claiming to be running in [dir: C:\Users\xt\code\d3]. For comparison, here's the corresponding command line output:

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'.

Here, make finds Makefile, right where we know it is. And that's where I reach the end of my proverbial bag of tricks.

So...thank you to anyone who bothered reading all this, and I appreciate your feedback.

Upvotes: 2

Views: 1928

Answers (1)

Sagar Sakre
Sagar Sakre

Reputation: 2426

Check the Line endings since windows, Linux and Mac uses different line endings.

Change the line ending settings in view -> Line endings try with the different options and check (May be its Windows, switch to Mac and check once).

Upvotes: 1

Related Questions