- PowerShell 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| docs | ||
| tests | ||
| .gitignore | ||
| .gitlab-ci.yml | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| LICENSE | ||
| make.ps1 | ||
| README.md | ||
psmake
psmake is a PowerShell implementation of make intended to process Makefiles on Microsoft Windows when make is not available, not installable, or blocked by local administration policies.
The goal is not to reproduce 100% of GNU make. The goal is to support a practical, well-documented subset that is useful on real projects and maintainable over time.
Status
Current entrypoint:
powershell.exe -File .\make.ps1
If PowerShell 7 is installed, pwsh also works.
Current scope includes:
- explicit targets and dependency traversal
- single-stem pattern rules with
% - variable assignment with
:=,?=, and= - conditionals:
ifeq,ifneq,ifdef,ifndef,else,endif - built-ins used by the supported subset:
wildcard,sort,shell,if - automatic variables:
$@,$<,$^,$* - recursive
$(MAKE)calls .PHONY,.DELETE_ON_ERROR,.SECONDEXPANSION- order-only prerequisites with
|
Why This Exists
Many Makefiles are shell-heavy and GNU-make-like, but the execution environment may be PowerShell-first, especially on Windows. This project provides a PowerShell-native driver while still running Makefile recipes through a POSIX shell when possible.
Quick Start
Run the default target:
powershell.exe -File .\make.ps1
Run a specific target:
powershell.exe -File .\make.ps1 test
Use a specific Makefile:
powershell.exe -File .\make.ps1 -f Makefile test
Change directory first:
powershell.exe -File .\make.ps1 -C docs pdf
Override make variables from the command line:
powershell.exe -File .\make.ps1 CAD=--bricscad test
Inspect a make variable after parsing:
powershell.exe -File .\make.ps1 --print-make-variable MAKE
Shell Execution
Although psmake is written in PowerShell, recipes are intentionally executed with a POSIX shell whenever one is available, because the supported Makefiles rely heavily on shell syntax.
Shell resolution order:
PSMAKE_BASHMAKE_BASH- on Windows, known TortoiseGit / Git for Windows
bash.exelocations bashorshfromPATH- the current PowerShell host (
powershell.exeorpwsh) as fallback
For recursive $(MAKE) execution, Windows intentionally prefers powershell.exe so that recursive builds still work even when pwsh is not installed or not reachable from bash.
Windows / TortoiseGit
If TortoiseGit is installed, psmake will try:
C:\Program Files\TortoiseGit\bin\bash.exe
You can also force an explicit shell:
$env:PSMAKE_BASH = 'C:\Program Files\TortoiseGit\bin\bash.exe'
powershell.exe -File .\make.ps1 test
PowerShell Script Restrictions
On some Windows machines, script execution may be blocked by policy. In that case, the most useful invocation forms are:
powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\make.ps1 test
If PowerShell 7 is installed, this also works:
pwsh -NoLogo -NoProfile -ExecutionPolicy Bypass -File .\make.ps1 test
If you only want to relax the policy for the current shell session:
Set-ExecutionPolicy -Scope Process Bypass
powershell.exe -File .\make.ps1 test
These options are especially useful on systems where installing GNU make or changing machine-wide policy is not possible.
Repository Layout
- make.ps1: main executable
- docs/SPECIFICATION.md: supported behavior and constraints
- docs/USER_MANUAL.md: usage guide
- docs/PLAN.md: project plan and milestones
- tests/run-tests.ps1: local test harness
- tests/fixtures: focused regression fixtures
- AGENTS.md: Codex guidance
- CLAUDE.md: Claude guidance
Supported GNU make Subset
Implemented today:
- comments and blank lines
- trailing
\line continuations :=,?=,=$(...)and${...}- substitution refs such as
$(VAR:.a=.b)and$(VAR:%.a=dir/%.b) - explicit rules
- single-stem pattern rules
- tab-indented recipes
- order-only prerequisites
- basic freshness checks for file targets
Not supported yet:
include,-include,sincludedefine/endef- target-specific variables
- static pattern rules
- parallel execution
- full GNU make function parity
Running Tests
powershell.exe -File .\tests\run-tests.ps1
The fixture suite covers:
- variable expansion
- pattern rules
- conditionals
- recursive
$(MAKE) - second expansion
.DELETE_ON_ERROR
Design Principle
Compatibility work should be driven by practical Makefile usage, not by abstract GNU make completeness. When a new feature is needed, the preferred workflow is:
- reproduce the requirement with a focused fixture
- implement the smallest compatible change
- document the behavior
- keep the regression test
Copying
This project is distributed under the GNU Affero General Public License, version 3.
You may copy, modify, and redistribute it under the terms of the license in LICENSE. If you run a modified version for users over a network, AGPL-3 also requires making the corresponding source available to those users.