I’d like to use an existing build system, the one for Make, but it only has two variants: default, and “Clean”. I’d like to add a “Test”. Is there a way to do that without creating an entirely new build system?
Add Variant to existing build system
Indeed there is, you can create an override of the file that’s contained in the default Makefile/Make.sublime-build
file that ships with Sublime, which will cause Sublime to use your override in place of the shipped file so that transparently the existing build system will contain the new variants you want to include.
The easiest way to do that is by using PackageResourceViewer. Once you have it installed:
- Select
PackageResourceViewer: Open Resource
from the Command Palette - Select
Makefile
in the list of packages - Select
Make.sublime-build
from the list of package files - Make modifications to the file and save it
When you save, a new Makefile
folder will be created in your Packages
folder (Preferences > Browse Packages
in the menu to see where that is) which contains this single file. Since the name of the folder has the same name as the package and the Make.sublime-build
file is contained in the package, Sublime will use your edited copy instead of the one that’s shipped in the package.
Note that once you do this, your version of the file will be used forever with no warning issued if the version that ships with Sublime is ever updated (this is true of all override files). In the case of a build system that’s probably not the end of the world, but the package OverrideAudit has the ability to warn you if that happens, amongst other things.
you may also want to consider creating a PR at https://github.com/sublimehq/Packages/blob/48ecc4a3bf38609397be9e5ad91ee5aa71e0a18e/Makefile/Make.sublime-build if others could also benefit from your changes