Makefile Explorer

Browse and run Makefile targets in a tree view — like NPM Scripts, but for Make. No more scrolling through massive Makefiles hunting for the right target.

Why?
When your Makefile grows to 50+ targets, finding the right one in a flat text file is painful. Makefile Explorer treats every Makefile like a folder of executable commands:
- Expand a Makefile node → see all targets at a glance
- Double-click a target → runs
make <target> in a dedicated terminal (each run gets its own terminal to avoid command conflicts)
- Click the 📎 icon or right-click → jumps straight to the definition line
Built for the monorepo reality: multiple Makefiles, nested directories, dozens of targets — all organized in one tree.
Features
- 🌲 Tree View — Targets grouped by Makefile in the Explorer sidebar
- ▶ Double-Click Execute — Double-click any target to run it in a dedicated terminal via Task API
- 🔍 Jump to Definition — Click the inline icon or right-click → "Go to Target Definition"
- 📋 Copy Make Command — Right-click a target → "Copy Make Command" to copy a terminal-ready command to clipboard
- ⌨️ Run Last Task —
Alt+Shift+R (mac Option+Shift+R) reruns the most recent target; persists across Dev Host restarts
- 🧪 Run with Args... — Right-click a target → "Run with Args..." to pass
KEY=VALUE pairs (e.g. VERSION=0.1.0) to the make command
- 🤫 Run in Background — Right-click a target → "Run in Background" to execute silently without popping up the terminal or stealing focus
- ⚙️ Configurable Double-Click — Setting
makefile-explorer.defaultRunMode lets you choose whether double-click opens the terminal (foreground, default) or runs silently (background)
- 📜 View as List — Toggle button in the view title bar to switch between tree view and a flat list of all targets (label
targetName [path/to/Makefile])
- ✓✗ Target Status Badges — Each target shows a green check or red cross after running; status persists in
context.globalState (FIFO-capped at 50)
- 📎 Dependency Display — Expand a target to see its dependencies (extracted from
target: dep1 dep2)
- 📊 Status Bar Indicator — Shows running/completed status for Make tasks in the VSCode status bar; tints red on failure
- 🔔 Make Availability Check — Warns on startup if
make is not found in PATH
- 📦 Task Grouping — Tasks are grouped by Makefile in the "Run Task" command palette
- 📝 Description Support — Extracts
## comments (above-target and inline) as descriptions
- 🔄 Auto-Refresh — Watches for file changes; tree stays in sync
- 🛡️ Smart Filtering — Skips
.PHONY, variable assignments, and empty targets
- 🚫 Dependency-Aware — Excludes
node_modules/, vendor/, .build/, and other third-party dirs
- 📦 Multi-Makefile — Finds
Makefile, makefile, GNUmakefile, *.mk, and Makefile.*
Usage
- Open a project that contains Makefiles
- Click the "Make Targets" view in the Explorer sidebar
- Expand a Makefile node to see its targets; expand a target node to see dependencies
- Double-click a target → executes
make <target> (behavior configurable via makefile-explorer.defaultRunMode setting: foreground pops up the terminal, background runs silently)
- Click the 📎 icon or right-click → "Go to Definition" → opens the Makefile at the target's line
- Right-click a target → "Copy Make Command" → copies
cd "dir" && make -f Makefile <target> to clipboard
- Right-click a target → "Run in Background" → executes silently without switching focus
- Right-click a target → "Run with Args..." → prompts for
KEY=VALUE pairs before execution
Targets can have descriptions extracted from comments:
# Build the project binary
# Uses release flags for optimization
build:
cargo build --release
test: ## Run the full test suite
cargo test
Above-target comments take priority over inline ## comments.
Extension Settings
This extension contributes the following settings:
| Setting |
Type |
Default |
Description |
makefile-explorer.defaultRunMode |
string |
"foreground" |
Double-click behavior: "foreground" (terminal + focus) or "background" (silent, no focus switch) |
Requirements
- VSCode 1.85.0 or later
make available in your $PATH
Known Issues
- Very large workspaces (1000+ Makefiles) may have a slight delay on first scan
- Targets with complex variable expansions in their names may not be detected
See the GitHub issues for the full list.
Development
# Install dependencies
npm install
# Compile
npm run compile
# Watch mode (auto-recompile on changes)
npm run watch
# Package for distribution
npm run package
Press F5 in VSCode to launch the Extension Development Host for debugging.
Project Structure
src/
├── extension.ts # Entry point: TreeView + command registration + status bar
├── models/
│ ├── MakefileNode.ts # TreeItem subclass (makefile / target / dependency nodes)
│ └── Target.ts # Type definitions (Target, NodeType)
├── providers/
│ ├── MakefileTreeProvider.ts # TreeDataProvider: scan + build tree + view mode
│ └── MakefileTaskProvider.ts # Task API: task creation + provider registration
├── services/
│ ├── MakefileScanner.ts # Workspace Makefile discovery + node construction
│ ├── TargetParser.ts # Makefile parser: extract targets + dependencies
│ ├── TaskHistoryService.ts # Persist last task + target status badges
│ ├── ArgsPromptService.ts # Input box for KEY=VALUE arguments
│ └── argsParser.ts # Parse KEY=VALUE argument strings
└── test/
├── MakefileTreeProvider.test.ts
├── TargetParser.test.ts
├── TaskHistoryService.test.ts
└── ArgsPromptService.test.ts
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
MIT — see LICENSE for details.
Enjoy! ⭐ this repo if you find it useful.