May 8, 2015

Sublime Text Editor Easy Build System With Makefile

The Sublime text editor build system can be a nightmare to configure and use, mainly if you need some complex steps to build your application or just have already a Makefile. Here you can see how build and run your applications from Sublime using shortcuts with Makefile.

The usual way to build application is using one of the "Tools -> Build System" templates for your source code language, that neither always work without edit and creating a new requires understand how Sublime build script works. So why not use the good old Makefile to deal with this? just call it from the Sublime script! Go to "Tools -> Build System->New Build System" and replace the new script with this:

 {  
      "working_dir": "${file_path}",  
      "cmd": ["make"],  
      "variants":  
 [  
   {  
        "working_dir": "${file_path}",  
     "name": "Run",  
     "cmd": ["./a.out"]  
   }  
 ]  
 }  

Now if you build the application (Ctrl + B), the command 'make' will be executed in the source file directory, and if you run it (Ctrl + Shift + B), the 'a.out' binary will be executed.

0 comentários :

Post a Comment