@@ -19,12 +19,15 @@ endif
1919# Find all Go source files
2020GO_SRC_FILES := $(shell powershell -NoProfile -ExecutionPolicy Bypass -Command "Get-ChildItem -Path . -Filter *.go -Recurse | Select-Object -ExpandProperty FullName")
2121
22+ # Define common PowerShell command
23+ PWSH := @powershell -NoProfile -ExecutionPolicy Bypass -Command
24+
2225# Default target
2326all: bin/git-sizer.exe
2427
2528# Main binary target - depend on all Go source files
2629bin/git-sizer.exe: $(GO_SRC_FILES)
27- @powershell -NoProfile -ExecutionPolicy Bypass -Command "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
30+ $(PWSH) "if (-not (Test-Path bin)) { New-Item -ItemType Directory -Path bin | Out-Null }"
2831 $(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -a -o .\bin\git-sizer.exe .
2932
3033# Test target - explicitly run the build first to ensure binary is up to date
@@ -38,17 +41,17 @@ gotest:
3841
3942# Clean up builds
4043clean:
41- @powershell -NoProfile -ExecutionPolicy Bypass -Command "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"
44+ $(PWSH) "if (Test-Path bin) { Remove-Item -Recurse -Force bin }"
4245
4346# Help target
4447help:
45- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
46- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
47- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Targets:' -ForegroundColor Green"
48- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' all - Build git-sizer (default)'"
49- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' test - Run tests'"
50- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' clean - Clean build artifacts'"
51- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ''"
52- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host 'Example usage:' -ForegroundColor Green"
53- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' nmake -f Makefile.win'"
54- @powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-Host ' nmake -f Makefile.win test'"
48+ $(PWSH) "Write-Host 'Windows Makefile for git-sizer' -ForegroundColor Cyan"
49+ $(PWSH) "Write-Host ''"
50+ $(PWSH) "Write-Host 'Targets:' -ForegroundColor Green"
51+ $(PWSH) "Write-Host ' all - Build git-sizer (default)'"
52+ $(PWSH) "Write-Host ' test - Run tests'"
53+ $(PWSH) "Write-Host ' clean - Clean build artifacts'"
54+ $(PWSH) "Write-Host ''"
55+ $(PWSH) "Write-Host 'Example usage:' -ForegroundColor Green"
56+ $(PWSH) "Write-Host ' make -f Makefile.win'"
57+ $(PWSH) "Write-Host ' make -f Makefile.win test'"
0 commit comments