ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Make​Commands

Automatic commands from make targets.

Details

Installs

  • Total 3K
  • Win 940
  • Mac 1K
  • Linux 1K
Dec 21 Dec 20 Dec 19 Dec 18 Dec 17 Dec 16 Dec 15 Dec 14 Dec 13 Dec 12 Dec 11 Dec 10 Dec 9 Dec 8 Dec 7 Dec 6 Dec 5 Dec 4 Dec 3 Dec 2 Dec 1 Nov 30 Nov 29 Nov 28 Nov 27 Nov 26 Nov 25 Nov 24 Nov 23 Nov 22 Nov 21 Nov 20 Nov 19 Nov 18 Nov 17 Nov 16 Nov 15 Nov 14 Nov 13 Nov 12 Nov 11 Nov 10 Nov 9 Nov 8 Nov 7
Windows 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Mac 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Linux 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

Readme

Source
bitbucket.​org

MakeCommands

Overview

If you have installed this package, there are automatically created sublime-commands from Makefiles' targets.

Motivation

I mostly work with makefiles and I am used to vim's :make command, where you can optionally pass a target. So you can run :make test or :make deploy, or whatever target is there.

This package makes targets available as sublime commands, such that you can run them from Command Palette.

Default Behaviour

If you are editing a file, which has a Makefile on same or higher level in directory structure, targets from it are automatically made available as commands. If there is a target "test", then there will be created command ":make test".

How Makefiles are Processed

Usually all targets containing only characters, numbers, "_" or "-", are made available as targets.

There may be produced too many targets from your makefiles and you only use a subset of the targets. Then you can create a special target .SUBLIME_TARGETS and list targets as prerequisites, which you want to access from sublime text:

.SUBLIME_TARGETS: all deploy test

This example would only make targets all, deploy and test available as commands regardless, which targets you have in your Makefile.

There is a special recipe for writing targets, which may have input and are always displayed as sublime-targets, even if they are not part of .SUBLIME_TARGETS.

Initial motivation for this mechanism was the need of an overall commit in the root of nested repositories even if editing a file in a subrepository.

First have a look at the targets:

sublime.hg-status:
    hg status

sublime.hg-commit.in-commit_message:
    hg commit -m "$(SUBLIME_INPUT_commit_message)"

sublime.hg-add.in-file:
    if [ -z $(SUBLIME_INPUT_file)] ; then \
        cd $(dirname $(SUBLIME_FILENAME)) ; \
        hg add $(SUBLIME_FILENAME) ; \
    else \
        cd $(dirname $(SUBLIME_INPUT_file)) ; \
        hg add $(SUBLIME_INPUT_file) ;\
    fi
sublime.hg-status
This target will be displayed as :make hg-status in command palette and displays the status of the repository the Makefile is in.
sublime.hg-commit.in-commit_message:
This target is represented by :make hg-commit in command palette and will first open input_panel and ask for a commit_message and then runs the target with SUBLIME_INPUT_commit_message make variable set.
sublime.hg-add.in-file:

This target is represented by :make hg-add in command palette and will ask for a file. If no filepath given, the view's filename represented by make variable SUBLIME_FILENAME will be taken, else the filepath entered will be taken and interpreted relative to Makefile.

Finally file represented by final filepath, will be added to nearest enclosing repository.

So it is easy to ask for interactive input, which you can later use in your make recipes.

Installation

Download Package Control and use Package Control: Install Package Command from command palette. Command Palette is opened using ctrl+shift+p on Windows and Linux and cmd+shift+p on Mac.

Once you run Package Control: Install Package, there will open up a list of packages. Type MakeCommands and hit enter.

Configuration

First a quick overview on configuration settings.

Setting Type Default
make_commands_makefiles String or List []
make_commands_makefile_pattern String "/Makefile$"
make_commands_stop_at_opened_folders Boolean true
make_commands_find_parent_makefile Boolean true
make_commands_search_in_opened_folders Boolean true
make_commands_command_caption_format Boolean true
make_commands_make_command String "make"
make_commands_debug Boolean false

make_commands_makefiles

Either a single makefile or a list of makefiles. You may either use absolute paths, or paths are interpreted relative to to one of the opened folders in your current window (project folders).

Example for single makefile:

{
    make_commands_makefiles: "foo.mak"
}

Example for list of makefiles:

{
    make_commands_makefiles: ["foo.mak", "path/to/bar.mak", "/path/to/Makefile"]
}

make_commands_makefile_pattern

Filepaths matching this pattern are considered as Makefiles.

If you also wanted :file:`*.mak` beeing considered, then you could specify:

{
    make_commands_makefile_pattern: "/Makefile$|\.mak$"
}

make_commands_stop_at_opened_folders

If there is turned on make_commands_find_parent_makefile, this toggle specifies, if it is stopped looking for Makefile at directory level of currently opened folders.

make_commands_find_parent_makefile

If this setting is turned on, there is tried to find a makefile matching make_commands_makefile_pattern in parent folders starting in folder of file in current view. Depending on make_commands_stop_at_opened_folders it is stopped in folders opened in current window.

make_commands_search_in_opened_folders

If this setting is turned on, it is looked for makefiles matching make_commands_makefile_pattern in opened folders.

make_commands_command_caption_format

This specifies how your commands' caption shall look like. Default is:

":make %(target)s"

make_commands_make_command

This specifies your make command. It defaults to make.

make_commands_debug

This toggle enables debug output to console panel.

License

You can use this under Simplified BSD License:

Copyright (c) 2013, Kay-Uwe (Kiwi) Lorenz All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Donate

If you want to honour this work, you can donate some money via paypal or buy me something from my amazon wishlist.