Skip to content

Instantly share code, notes, and snippets.

@mattmc3
Created April 6, 2017 00:44
Show Gist options
  • Star 18 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mattmc3/c021236c92c03b61d92c0ff233940643 to your computer and use it in GitHub Desktop.
Save mattmc3/c021236c92c03b61d92c0ff233940643 to your computer and use it in GitHub Desktop.
VSCode tasks for running a Makefile
// Makefile
// ${workspaceRoot} the path of the folder opened in VS Code
// ${file} the current opened file
// ${fileBasename} the current opened file's basename
// ${fileDirname} the current opened file's dirname
// ${fileExtname} the current opened file's extension
// ${cwd} the task runner's current working directory on startup
{
"version": "0.1.0",
"command": "bash",
"isShellCommand": true,
"showOutput": "always",
"options": {
"cwd": "${workspaceRoot}"
},
"args": [
"-c"
],
"tasks": [
{
"taskName": "build",
"suppressTaskName": true,
"isBuildCommand": true,
"args": ["make build"]
},
{
"taskName": "test",
"suppressTaskName": true,
"isTestCommand": true,
"args": ["make test"]
},
{
"taskName": "deploy",
"suppressTaskName": true,
"args": ["make deploy"]
},
{
"taskName": "help",
"suppressTaskName": true,
"args": ["make help"]
}
]
}
@dadabit
Copy link

dadabit commented Dec 26, 2021

thank you

@Nelstaar
Copy link

Nelstaar commented Jun 17, 2022

best tasks.json so far.

@fripSide
Copy link

The "0.1.0" version is out of date and may keywords are deprecated.
Here is a new and correct version from ChatGPT.

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "make all",
            "type": "shell",
            "command": "make all",
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "problemMatcher": "$gcc"
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment